@@ -41,11 +41,17 @@ test_collection <- function(test, sub_test = NULL,
41
41
42
42
out_names <- construct_out(in_names )
43
43
44
- in_items <- file.path(path , in_names )
45
- out_items <- file.path(tempdir(), out_names )
46
- ref_items <- file.path(path , out_names )
47
- file.copy(ref_items , out_items , overwrite = TRUE , copy.mode = FALSE )
48
- out_trees <- file.path(tempdir(), construct_tree(in_names ))
44
+ if (getOption(" styler.test_dir_unwritable" )) {
45
+ in_items <- file.path(path , in_names )
46
+ out_items <- file.path(tempdir(), out_names )
47
+ ref_items <- file.path(path , out_names )
48
+ file.copy(ref_items , out_items , overwrite = TRUE , copy.mode = FALSE )
49
+ out_trees <- file.path(tempdir(), construct_tree(in_names ))
50
+ } else {
51
+ out_items <- file.path(path , out_names )
52
+ in_items <- file.path(path , in_names )
53
+ out_trees <- construct_tree(in_items )
54
+ }
49
55
50
56
pwalk(list (in_items , out_items , in_names , out_names , out_trees ),
51
57
transform_and_check ,
@@ -107,7 +113,8 @@ transform_and_check <- function(in_item, out_item,
107
113
read_in <- xfun :: read_utf8(in_item )
108
114
if (write_tree ) {
109
115
create_tree(read_in ) %> %
110
- write.table(out_tree , col.names = FALSE , row.names = FALSE , quote = FALSE , fileEncoding = " UTF-8" )
116
+ write.table(out_tree , col.names = FALSE , row.names = FALSE , quote = FALSE ,
117
+ fileEncoding = " UTF-8" )
111
118
}
112
119
transformed_text <- read_in %> %
113
120
transformer(... ) %> %
0 commit comments