Skip to content

Commit 61f8bab

Browse files
committed
Revert expect-known changes
1 parent 9104922 commit 61f8bab

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

tests/testthat/test-expect-known.R

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,17 @@ test_that("ignores incomplete last line", {
2424
writeLines("Hi!", file)
2525
expect_success(expect_known_output(cat("Hi!"), file))
2626
expect_success(expect_known_output(cat("Hi!\n"), file))
27-
expect_snapshot_failure(expect_known_output(cat("Hi!\n\n"), file))
28-
expect_snapshot_failure(expect_known_output(cat("oops"), file))
27+
expect_failure(expect_known_output(cat("Hi!\n\n"), file))
28+
expect_failure(expect_known_output(cat("oops"), file))
2929
})
3030

3131
test_that("updates by default", {
3232
file <- withr::local_tempfile()
3333
writeLines("Hi!", file)
34-
expect_snapshot_failure(expect_known_output(
35-
cat("oops"),
36-
file,
37-
update = FALSE
38-
))
34+
expect_failure(expect_known_output(cat("oops"), file, update = FALSE))
3935

4036
expect_equal(readLines(file), "Hi!")
41-
expect_snapshot_failure(expect_known_output(cat("oops"), file, update = TRUE))
37+
expect_failure(expect_known_output(cat("oops"), file, update = TRUE))
4238
expect_success(expect_known_output(cat("oops"), file))
4339
})
4440

@@ -59,7 +55,7 @@ test_that("Warning for non-UTF-8 reference files", {
5955
writeBin(x, tmp)
6056

6157
suppressWarnings(
62-
expect_snapshot_failure(
58+
expect_failure(
6359
expect_known_output("foobar", tmp, update = FALSE)
6460
)
6561
)
@@ -73,7 +69,7 @@ test_that("correctly matches to a file", {
7369
expect_success(expect_known_value(x, "one.rds"))
7470

7571
x <- 2
76-
expect_snapshot_failure(expect_known_value(x, "one.rds", update = FALSE))
72+
expect_failure(expect_known_value(x, "one.rds", update = FALSE))
7773
})
7874

7975
test_that("first run is successful", {
@@ -93,15 +89,11 @@ test_that("equal_to_ref does not overwrite existing", {
9389
expect_success(expect_equal_to_reference(ref_obj1, tmp_rds))
9490

9591
# Failure does not update object
96-
expect_snapshot_failure(expect_equal_to_reference(ref_obj2, tmp_rds))
92+
expect_failure(expect_equal_to_reference(ref_obj2, tmp_rds))
9793
expect_equal(readRDS(tmp_rds), ref_obj1)
9894

9995
# Now failure does update object
100-
expect_snapshot_failure(expect_equal_to_reference(
101-
ref_obj2,
102-
tmp_rds,
103-
update = TRUE
104-
))
96+
expect_failure(expect_equal_to_reference(ref_obj2, tmp_rds, update = TRUE))
10597
expect_success(expect_equal_to_reference(ref_obj2, tmp_rds))
10698
})
10799

@@ -139,5 +131,5 @@ test_that("empty hash succeeds with warning", {
139131

140132
test_that("only succeeds if hash is correct", {
141133
expect_success(expect_known_hash(1:10, "c08951d2c2"))
142-
expect_snapshot_failure(expect_known_hash(1:10, "c08951d2c3"))
134+
expect_failure(expect_known_hash(1:10, "c08951d2c3"))
143135
})

0 commit comments

Comments
 (0)