Skip to content

Commit ecfed10

Browse files
use feedback
1 parent 60897d9 commit ecfed10

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.dev/gen_roxygen_tests.R

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
#!/usr/bin/Rscript
22
# execute from package TLD: ./.dev/gen_roxygen_tests.R
3-
all_examples <- list.files("tests/testthat/roxygen-examples-complete", full.names = TRUE)
4-
unique_tests <- unique(sub("-.*", "", basename(all_examples)))
3+
roxygen_stub <- "roxygen-examples-complete"
4+
all_examples <- list.files(file.path("tests", "testthat", roxygen_stub))
5+
unique_tests <- unique(sub("-.*", "", all_examples))
6+
7+
# tests using 'scope = "spaces"' in test_collection()
8+
tests_scope_spaces <- "15"
59

610
for (test in unique_tests) {
7-
out_file <- file.path("tests", "testthat", paste0("test-roxygen-examples-complete-", test, ".R"))
8-
extras <- if (test == "15") ', scope = "spaces"' else ""
11+
out_file <- file.path("tests", "testthat", paste0("test-", roxygen_stub, "-", test, ".R"))
12+
extras <- if (test %in% tests_scope_spaces) ', scope = "spaces"' else ""
913
writeLines(con = out_file, c(
1014
"# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.",
1115
"",
12-
sprintf('test_that("analogous to test-roxygen-examples-complete: %s", {', test),
13-
sprintf(' expect_warning(test_collection("roxygen-examples-complete", "^%s-", transformer = style_text%s), NA)', test, extras),
16+
sprintf('test_that("analogous to test-%s: %s", {', roxygen_stub, test),
17+
sprintf(
18+
' expect_warning(test_collection("%s", "^%s-", transformer = style_text%s), NA)',
19+
roxygen_stub, test, extras
20+
),
1421
"})",
1522
NULL
1623
))

0 commit comments

Comments
 (0)