Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add a script for generating many roxygen-examples-complete tests, apply it #1111

Merged
merged 10 commits into from
Dec 3, 2023
17 changes: 17 additions & 0 deletions .dev/gen_roxygen_tests.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/Rscript
# execute from package TLD: ./.dev/gen_roxygen_tests.R
IndrajeetPatil marked this conversation as resolved.
Show resolved Hide resolved
all_examples <- list.files("tests/testthat/roxygen-examples-complete", full.names = TRUE)
unique_tests <- unique(sub("-.*", "", basename(all_examples)))

MichaelChirico marked this conversation as resolved.
Show resolved Hide resolved
for (test in unique_tests) {
out_file <- file.path("tests", "testthat", paste0("test-roxygen-examples-complete-", test, ".R"))
extras <- if (test == "15") ', scope = "spaces"' else ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid magic string here? What's special about "15"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

MichaelChirico marked this conversation as resolved.
Show resolved Hide resolved
writeLines(con = out_file, c(
"# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.",
"",
sprintf('test_that("analogous to test-roxygen-examples-complete: %s", {', test),
sprintf(' expect_warning(test_collection("roxygen-examples-complete", "^%s-", transformer = style_text%s), NA)', test, extras),
"})",
NULL
))
}
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-01.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 01", {
expect_warning(test_collection("roxygen-examples-complete", "^01-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-02.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 02", {
expect_warning(test_collection("roxygen-examples-complete", "^02-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-03.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 03", {
expect_warning(test_collection("roxygen-examples-complete", "^03-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-04.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 04", {
expect_warning(test_collection("roxygen-examples-complete", "^04-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-05.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 05", {
expect_warning(test_collection("roxygen-examples-complete", "^05-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-06.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 06", {
expect_warning(test_collection("roxygen-examples-complete", "^06-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-07.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 07", {
expect_warning(test_collection("roxygen-examples-complete", "^07-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-08.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 08", {
expect_warning(test_collection("roxygen-examples-complete", "^08-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-09.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 09", {
expect_warning(test_collection("roxygen-examples-complete", "^09-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-10.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 10", {
expect_warning(test_collection("roxygen-examples-complete", "^10-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-11.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 11", {
expect_warning(test_collection("roxygen-examples-complete", "^11-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-12.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 12", {
expect_warning(test_collection("roxygen-examples-complete", "^12-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-13.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 13", {
expect_warning(test_collection("roxygen-examples-complete", "^13-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-14.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 14", {
expect_warning(test_collection("roxygen-examples-complete", "^14-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-15.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 15", {
expect_warning(test_collection("roxygen-examples-complete", "^15-", transformer = style_text, scope = "spaces"), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-16.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 16", {
expect_warning(test_collection("roxygen-examples-complete", "^16-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-17.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 17", {
expect_warning(test_collection("roxygen-examples-complete", "^17-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-18.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 18", {
expect_warning(test_collection("roxygen-examples-complete", "^18-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-19.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 19", {
expect_warning(test_collection("roxygen-examples-complete", "^19-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-20.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 20", {
expect_warning(test_collection("roxygen-examples-complete", "^20-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-21.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 21", {
expect_warning(test_collection("roxygen-examples-complete", "^21-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-22.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 22", {
expect_warning(test_collection("roxygen-examples-complete", "^22-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-23.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 23", {
expect_warning(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-24.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 24", {
expect_warning(test_collection("roxygen-examples-complete", "^24-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-25.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 25", {
expect_warning(test_collection("roxygen-examples-complete", "^25-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-26.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 26", {
expect_warning(test_collection("roxygen-examples-complete", "^26-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-27.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 27", {
expect_warning(test_collection("roxygen-examples-complete", "^27-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-28.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 28", {
expect_warning(test_collection("roxygen-examples-complete", "^28-", transformer = style_text), NA)
})
5 changes: 5 additions & 0 deletions tests/testthat/test-roxygen-examples-complete-29.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.

test_that("analogous to test-roxygen-examples-complete: 29", {
expect_warning(test_collection("roxygen-examples-complete", "^29-", transformer = style_text), NA)
})
152 changes: 0 additions & 152 deletions tests/testthat/test-roxygen-examples-complete.R

This file was deleted.