@@ -41,10 +41,17 @@ test_collection <- function(test, sub_test = NULL,
4141
4242 out_names <- construct_out(in_names )
4343
44- out_items <- file.path(path , out_names )
45- in_items <- file.path(path , in_names )
46-
47- out_trees <- construct_tree(in_items )
44+ if (getOption(" styler.test_dir_writable" , TRUE )) {
45+ out_items <- file.path(path , out_names )
46+ in_items <- file.path(path , in_names )
47+ out_trees <- construct_tree(in_items )
48+ } else {
49+ in_items <- file.path(path , in_names )
50+ out_items <- file.path(tempdir(), out_names )
51+ ref_items <- file.path(path , out_names )
52+ file.copy(ref_items , out_items , overwrite = TRUE , copy.mode = FALSE )
53+ out_trees <- file.path(tempdir(), construct_tree(in_names ))
54+ }
4855
4956 pwalk(list (in_items , out_items , in_names , out_names , out_trees ),
5057 transform_and_check ,
@@ -106,7 +113,9 @@ transform_and_check <- function(in_item, out_item,
106113 read_in <- xfun :: read_utf8(in_item )
107114 if (write_tree ) {
108115 create_tree(read_in ) %> %
109- 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"
118+ )
110119 }
111120 transformed_text <- read_in %> %
112121 transformer(... ) %> %
0 commit comments