@@ -48,8 +48,8 @@ test_that("expect_snapshot_file works in a different directory", {
4848
4949test_that(" expect_snapshot_file works with variant" , {
5050 expect_snapshot_file(
51- write_tmp_lines(version $ nickname ),
52- " nickname .txt" ,
51+ write_tmp_lines(r_version() ),
52+ " version .txt" ,
5353 compare = compare_file_text ,
5454 variant = r_version()
5555 )
@@ -96,35 +96,35 @@ test_that("warns on first creation", {
9696
9797 # Warns on first run
9898 expect_warning(
99- expect_true(snapshot_file_equal(tempdir(), " test.txt" , path )),
99+ expect_true(snapshot_file_equal(tempdir(), " test.txt" , NULL , path )),
100100 " new file snapshot"
101101 )
102102
103103 # Errors on non-existing file
104104 expect_error(
105- expect_true(snapshot_file_equal(tempdir(), " test.txt" , " doesnt-exist.txt" )),
105+ expect_true(snapshot_file_equal(tempdir(), " test.txt" , NULL , " doesnt-exist.txt" )),
106106 " `doesnt-exist.txt` not found"
107107 )
108108
109109
110110 # Unchanged returns TRUE
111- expect_true(snapshot_file_equal(tempdir(), " test.txt" , path ))
111+ expect_true(snapshot_file_equal(tempdir(), " test.txt" , NULL , path ))
112112 expect_true(file.exists(file.path(tempdir(), " test.txt" )))
113113 expect_false(file.exists(file.path(tempdir(), " test.new.txt" )))
114114
115115 # Changed returns FALSE
116116 path2 <- write_tmp_lines(" b" )
117- expect_false(snapshot_file_equal(tempdir(), " test.txt" , path2 ))
117+ expect_false(snapshot_file_equal(tempdir(), " test.txt" , NULL , path2 ))
118118 expect_true(file.exists(file.path(tempdir(), " test.txt" )))
119119 expect_true(file.exists(file.path(tempdir(), " test.new.txt" )))
120120
121121 # Changing again overwrites
122122 path2 <- write_tmp_lines(" c" )
123- expect_false(snapshot_file_equal(tempdir(), " test.txt" , path2 ))
123+ expect_false(snapshot_file_equal(tempdir(), " test.txt" , NULL , path2 ))
124124 expect_equal(brio :: read_lines(file.path(tempdir(), " test.new.txt" )), " c" )
125125
126126 # Unchanged cleans up
127- expect_true(snapshot_file_equal(tempdir(), " test.txt" , path ))
127+ expect_true(snapshot_file_equal(tempdir(), " test.txt" , NULL , path ))
128128 expect_true(file.exists(file.path(tempdir(), " test.txt" )))
129129 expect_false(file.exists(file.path(tempdir(), " test.new.txt" )))
130130})
0 commit comments