Skip to content

Commit 84e2bd8

Browse files
authored
Revert unintended white space changes
1 parent 0fa3d40 commit 84e2bd8

File tree

3 files changed

+11
-40
lines changed

3 files changed

+11
-40
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@
300300

301301
* Test results show hyperlinks to failed expectation when supported (#1544).
302302

303+
303304
# testthat 3.1.2
304305

305306
* testthat now uses brio for all reading and writing (#1120). This

tests/testthat/test-snapshot-file.R

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ test_that("basic workflow", {
7070

7171
# warns on first run
7272
snapper$start_file("snapshot-6", "test")
73-
expect_warning(
74-
expect_snapshot_file(write_tmp_lines(letters), "letters.txt"),
75-
"Adding new"
76-
)
73+
expect_warning(expect_snapshot_file(write_tmp_lines(letters), "letters.txt"), "Adding new")
7774
snapper$end_file()
7875

7976
# succeeds if unchanged
@@ -83,10 +80,7 @@ test_that("basic workflow", {
8380

8481
# fails if changed
8582
snapper$start_file("snapshot-6", "test")
86-
expect_failure(expect_snapshot_file(
87-
write_tmp_lines(letters[-1]),
88-
"letters.txt"
89-
))
83+
expect_failure(expect_snapshot_file(write_tmp_lines(letters[-1]), "letters.txt"))
9084
snapper$end_file()
9185
})
9286

@@ -118,12 +112,7 @@ test_that("warns on first creation", {
118112

119113
# Errors on non-existing file
120114
expect_error(
121-
expect_true(snapshot_file_equal(
122-
tempdir(),
123-
"test.txt",
124-
NULL,
125-
"doesnt-exist.txt"
126-
)),
115+
expect_true(snapshot_file_equal(tempdir(), "test.txt", NULL, "doesnt-exist.txt")),
127116
"`doesnt-exist.txt` not found"
128117
)
129118

@@ -178,22 +167,7 @@ test_that("snapshot_hint output differs in R CMD check", {
178167
testthat:::snapshot_review_hint(..., reset_output = FALSE)
179168
}
180169

181-
expect_snapshot(cat(snapshot_review_hint(
182-
"lala",
183-
"foo.r",
184-
check = FALSE,
185-
ci = FALSE
186-
)))
187-
expect_snapshot(cat(snapshot_review_hint(
188-
"lala",
189-
"foo.r",
190-
check = TRUE,
191-
ci = FALSE
192-
)))
193-
expect_snapshot(cat(snapshot_review_hint(
194-
"lala",
195-
"foo.r",
196-
check = TRUE,
197-
ci = TRUE
198-
)))
170+
expect_snapshot(cat(snapshot_review_hint("lala", "foo.r", check = FALSE, ci = FALSE)))
171+
expect_snapshot(cat(snapshot_review_hint("lala", "foo.r", check = TRUE, ci = FALSE)))
172+
expect_snapshot(cat(snapshot_review_hint("lala", "foo.r", check = TRUE, ci = TRUE)))
199173
})

tests/testthat/test-snapshot.R

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ test_that("multiple outputs of same type are collapsed", {
3939
expect_snapshot({
4040
x <- 1
4141
y <- 1
42-
{
43-
message("a")
44-
message("b")
45-
}
46-
{
47-
warning("a")
48-
warning("b")
49-
}
42+
{message("a"); message("b")}
43+
{warning("a"); warning("b")}
5044
})
5145
})
5246

@@ -175,7 +169,9 @@ test_that("hint is informative", {
175169
})
176170

177171
test_that("expect_snapshot requires a non-empty test label", {
172+
178173
test_that("", {
179174
expect_error(expect_snapshot(1 + 1))
180175
})
176+
181177
})

0 commit comments

Comments
 (0)