diff --git a/.Rbuildignore b/.Rbuildignore index 8f4e9970b..cbf4dd311 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,6 +7,7 @@ ^README-.*\.png$ ^README\.Rmd$ ^\.Rproj\.user$ +^\.dev$ ^\.github$ ^\.gitsum$ ^\.lintr$ diff --git a/tests/dev/gen_roxygen_tests.R b/tests/dev/gen_roxygen_tests.R new file mode 100755 index 000000000..d260e4797 --- /dev/null +++ b/tests/dev/gen_roxygen_tests.R @@ -0,0 +1,28 @@ +#!/usr/bin/Rscript +# execute from package TLD: ./tests/dev/gen_roxygen_tests.R +roxygen_stub <- "roxygen-examples-complete" +all_examples <- list.files(file.path("tests", "testthat", roxygen_stub)) +unique_tests <- unique(sub("-.*", "", all_examples)) + +# tests using 'scope = "spaces"' in test_collection() +tests_scope_spaces <- "15" + +condition_map <- list(`23` = c("error", '"issues/1242"')) + +for (test in unique_tests) { + out_file <- file.path("tests", "testthat", paste0("test-", roxygen_stub, "-", test, ".R")) + extras <- if (test %in% tests_scope_spaces) ', scope = "spaces"' else "" + condition <- condition_map[[test]] + if (is.null(condition)) condition <- c("warning", "NA") + writeLines(con = out_file, c( + "# NB: DO NOT EDIT. Auto-generated by .dev/gen_roxygen_tests.R.", + "", + sprintf('test_that("analogous to test-%s: %s", {', roxygen_stub, test), + sprintf( + ' expect_%s(test_collection("%s", "^%s-", transformer = style_text%s), %s)', + condition[1L], roxygen_stub, test, extras, condition[2L] + ), + "})", + NULL + )) +} diff --git a/tests/testthat/test-roxygen-examples-complete-01.R b/tests/testthat/test-roxygen-examples-complete-01.R new file mode 100644 index 000000000..478217bbd --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-01.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-02.R b/tests/testthat/test-roxygen-examples-complete-02.R new file mode 100644 index 000000000..19bc51362 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-02.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-03.R b/tests/testthat/test-roxygen-examples-complete-03.R new file mode 100644 index 000000000..8a2d15512 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-03.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-04.R b/tests/testthat/test-roxygen-examples-complete-04.R new file mode 100644 index 000000000..87612f3e9 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-04.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-05.R b/tests/testthat/test-roxygen-examples-complete-05.R new file mode 100644 index 000000000..c93864dde --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-05.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-06.R b/tests/testthat/test-roxygen-examples-complete-06.R new file mode 100644 index 000000000..e2e069183 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-06.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-07.R b/tests/testthat/test-roxygen-examples-complete-07.R new file mode 100644 index 000000000..7b3ac96ab --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-07.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-08.R b/tests/testthat/test-roxygen-examples-complete-08.R new file mode 100644 index 000000000..c1225c62b --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-08.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-09.R b/tests/testthat/test-roxygen-examples-complete-09.R new file mode 100644 index 000000000..fe3d7b7ae --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-09.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-10.R b/tests/testthat/test-roxygen-examples-complete-10.R new file mode 100644 index 000000000..98e23a915 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-10.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-11.R b/tests/testthat/test-roxygen-examples-complete-11.R new file mode 100644 index 000000000..9bcd7a142 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-11.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-12.R b/tests/testthat/test-roxygen-examples-complete-12.R new file mode 100644 index 000000000..baddb8143 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-12.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-13.R b/tests/testthat/test-roxygen-examples-complete-13.R new file mode 100644 index 000000000..c2a711fb6 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-13.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-14.R b/tests/testthat/test-roxygen-examples-complete-14.R new file mode 100644 index 000000000..9d9447335 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-14.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-15.R b/tests/testthat/test-roxygen-examples-complete-15.R new file mode 100644 index 000000000..2c309d95a --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-15.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-16.R b/tests/testthat/test-roxygen-examples-complete-16.R new file mode 100644 index 000000000..f15429d75 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-16.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-17.R b/tests/testthat/test-roxygen-examples-complete-17.R new file mode 100644 index 000000000..66cbf9b1a --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-17.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-18.R b/tests/testthat/test-roxygen-examples-complete-18.R new file mode 100644 index 000000000..814d057b0 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-18.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-19.R b/tests/testthat/test-roxygen-examples-complete-19.R new file mode 100644 index 000000000..93d205826 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-19.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-20.R b/tests/testthat/test-roxygen-examples-complete-20.R new file mode 100644 index 000000000..79ac89408 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-20.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-21.R b/tests/testthat/test-roxygen-examples-complete-21.R new file mode 100644 index 000000000..6e6fa4948 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-21.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-22.R b/tests/testthat/test-roxygen-examples-complete-22.R new file mode 100644 index 000000000..0e2c4334e --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-22.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-23.R b/tests/testthat/test-roxygen-examples-complete-23.R new file mode 100644 index 000000000..ce1b5833a --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-23.R @@ -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_error(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), "issues/1242") +}) diff --git a/tests/testthat/test-roxygen-examples-complete-24.R b/tests/testthat/test-roxygen-examples-complete-24.R new file mode 100644 index 000000000..7ceb13a83 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-24.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-25.R b/tests/testthat/test-roxygen-examples-complete-25.R new file mode 100644 index 000000000..f36b00424 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-25.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-26.R b/tests/testthat/test-roxygen-examples-complete-26.R new file mode 100644 index 000000000..ee55bcd21 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-26.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-27.R b/tests/testthat/test-roxygen-examples-complete-27.R new file mode 100644 index 000000000..8dfa9e0b2 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-27.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-28.R b/tests/testthat/test-roxygen-examples-complete-28.R new file mode 100644 index 000000000..d12fb6696 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-28.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete-29.R b/tests/testthat/test-roxygen-examples-complete-29.R new file mode 100644 index 000000000..bf30fe968 --- /dev/null +++ b/tests/testthat/test-roxygen-examples-complete-29.R @@ -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) +}) diff --git a/tests/testthat/test-roxygen-examples-complete.R b/tests/testthat/test-roxygen-examples-complete.R deleted file mode 100644 index 0d78cc4f0..000000000 --- a/tests/testthat/test-roxygen-examples-complete.R +++ /dev/null @@ -1,152 +0,0 @@ -test_that("analogous to test-roxygen-examples-complete", { - expect_warning(test_collection( - "roxygen-examples-complete", "^01", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^11", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^12-fun", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^12-dont", - transformer = style_text - ), NA) - - - expect_warning(test_collection( - "roxygen-examples-complete", "^13", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^14", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^02", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^03", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^04", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^05", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^06", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^07", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^08", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^09", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^10", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^15", - transformer = style_text, scope = "spaces" - ), NA) - - # Don't warn about empty strings in roxygen comments - expect_warning(test_collection( - "roxygen-examples-complete", "^16", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^17", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^18", - transformer = style_text - ), NA) - expect_warning(test_collection( - "roxygen-examples-complete", "^19", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^20", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^21", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^22", - transformer = style_text - ), NA) - - expect_error(test_collection( - "roxygen-examples-complete", "^23", - transformer = style_text - ), "issues/1242") - - expect_warning(test_collection( - "roxygen-examples-complete", "^24", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^25", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^26", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^27", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^28", - transformer = style_text - ), NA) - - expect_warning(test_collection( - "roxygen-examples-complete", "^29", - transformer = style_text - ), NA) -})