Skip to content

Commit 911b837

Browse files
committed
More alignment
1 parent 19c00c1 commit 911b837

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# testthat (development version)
22

3+
* `test_that()` no longer warns about the absence of `{}` since it no longer seems to be necessary.
34
* `test_that()`, `describe()`, and `it()` can now be arbitrarily nested. Each component will skip only if it and its subtests don't contain any expectations. The interactive stop reporter has been fixed so it doesn't duplicate failures. (#2063, #2188).
45
* Test filtering now works with `it()`, and the `desc` argument can take a character vector in order to recursively filter subtests (i.e. `it()` nested inside of `describe()`) (#2118).
56
* New `snapshot_reject()` rejects all modified snapshots by deleting the `.new` variants (#1923).

R/test-that.R

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ test_that <- function(desc, code) {
3737
local_description_push(desc)
3838

3939
code <- substitute(code)
40-
if (edition_get() >= 3) {
41-
if (!is_call(code, "{")) {
42-
cli::cli_warn(
43-
"The {.arg code} argument to {.fn test_that} must be a braced expression to get accurate file-line information for failures.",
44-
class = "testthat_braces_warning"
45-
)
46-
}
47-
}
48-
4940
test_code(code, parent.frame())
5041
}
5142

man/source_file.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-describe.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ describe("describe", {
1111
})
1212
})
1313
})
14+
})
1415

15-
it("can have not yet implemented specs", {
16-
describe("Millennium Prize Problems", {
17-
it("can be shown that P != NP")
16+
test_that("unimplemented specs generate skips", {
17+
expectations <- capture_expectations({
18+
it("can have not yet implemented specs", {
19+
describe("Millennium Prize Problems", {
20+
it("can be shown that P != NP")
21+
})
1822
})
1923
})
24+
expect_length(expectations, 1)
25+
expect_s3_class(expectations[[1]], "expectation_skip")
2026
})
2127

2228
someExternalVariable <- 1

tests/testthat/test-test-that.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ test_that("can signal warnings and messages without restart", {
148148
expect_null(signalCondition(warning_cnd("foo")))
149149
})
150150

151-
test_that("braces required in testthat 3e", {
152-
local_edition(3)
153-
expect_warning(
154-
test_that("", expect_true(TRUE))
155-
)
156-
})
157151

158152
test_that("no braces required in testthat 2e", {
159153
local_edition(2)

0 commit comments

Comments
 (0)