Skip to content

Commit 61653d5

Browse files
committed
Do reset test count; update comments
1 parent fe0a15b commit 61653d5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

R/test-that.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ test_code <- function(code, env, reporter = NULL, skip_on_empty = TRUE) {
6464
withr::defer(reporter$end_test(context = reporter$.context, test = test))
6565
}
6666

67-
# Want to skip if the test (and its subtests) have no expectations
68-
# if (the$top_level_test) {
69-
# the$test_expectations <- 0
70-
# the$top_level_test <- FALSE
71-
# withr::defer(the$top_level_test <- TRUE)
72-
# }
67+
if (the$top_level_test) {
68+
# Not strictly necessary but nice to reset the count
69+
the$test_expectations <- 0
70+
the$top_level_test <- FALSE
71+
withr::defer(the$top_level_test <- TRUE)
72+
}
73+
# Used to skip if the test _and_ its subtests have no expectations
7374
starting_expectations <- the$test_expectations
7475

7576
ok <- TRUE

0 commit comments

Comments
 (0)