Skip to content

Commit 0f58421

Browse files
error not warning
1 parent 037dc47 commit 0f58421

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.dev/gen_roxygen_tests.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ unique_tests <- unique(sub("-.*", "", all_examples))
77
# tests using 'scope = "spaces"' in test_collection()
88
tests_scope_spaces <- "15"
99

10-
warning_map <- c(`23` = '"issues/1242"')
10+
condition_map <- list(`23` = c("error", '"issues/1242"'))
1111

1212
for (test in unique_tests) {
1313
out_file <- file.path("tests", "testthat", paste0("test-", roxygen_stub, "-", test, ".R"))
1414
extras <- if (test %in% tests_scope_spaces) ', scope = "spaces"' else ""
15+
condition <- condition_map[[test]]
16+
if (is.null(condition)) condition <- c("warning", "NA")
1517
writeLines(con = out_file, c(
1618
"# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.",
1719
"",
1820
sprintf('test_that("analogous to test-%s: %s", {', roxygen_stub, test),
1921
sprintf(
20-
' expect_warning(test_collection("%s", "^%s-", transformer = style_text%s), %s)',
21-
roxygen_stub, test, extras, warning_map[test]
22+
' expect_%s(test_collection("%s", "^%s-", transformer = style_text%s), %s)',
23+
condition[1L], roxygen_stub, test, extras, condition[2L]
2224
),
2325
"})",
2426
NULL
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.
22

33
test_that("analogous to test-roxygen-examples-complete: 23", {
4-
expect_warning(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), "issues/1242")
4+
expect_error(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), "issues/1242")
55
})

0 commit comments

Comments
 (0)