From 23972b3039cb3d3e3ced5d985dd44da0231ebfed Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Fri, 7 Apr 2023 21:39:28 +0000 Subject: [PATCH 1/6] script for generating roxygen-examples-complete --- .dev/gen_roxygen_tests.R | 17 ++ .../test-roxygen-examples-complete-01.R | 5 + .../test-roxygen-examples-complete-02.R | 5 + .../test-roxygen-examples-complete-03.R | 5 + .../test-roxygen-examples-complete-04.R | 5 + .../test-roxygen-examples-complete-05.R | 5 + .../test-roxygen-examples-complete-06.R | 5 + .../test-roxygen-examples-complete-07.R | 5 + .../test-roxygen-examples-complete-08.R | 5 + .../test-roxygen-examples-complete-09.R | 5 + .../test-roxygen-examples-complete-10.R | 5 + .../test-roxygen-examples-complete-11.R | 5 + .../test-roxygen-examples-complete-12.R | 5 + .../test-roxygen-examples-complete-13.R | 5 + .../test-roxygen-examples-complete-14.R | 5 + .../test-roxygen-examples-complete-15.R | 5 + .../test-roxygen-examples-complete-16.R | 5 + .../test-roxygen-examples-complete-17.R | 5 + .../test-roxygen-examples-complete-18.R | 5 + .../test-roxygen-examples-complete-19.R | 5 + .../test-roxygen-examples-complete-20.R | 5 + .../test-roxygen-examples-complete-21.R | 5 + .../test-roxygen-examples-complete-22.R | 5 + .../test-roxygen-examples-complete-23.R | 5 + .../test-roxygen-examples-complete-24.R | 5 + .../test-roxygen-examples-complete-25.R | 5 + .../test-roxygen-examples-complete-26.R | 5 + .../test-roxygen-examples-complete-27.R | 5 + .../test-roxygen-examples-complete-28.R | 5 + .../test-roxygen-examples-complete-29.R | 5 + .../testthat/test-roxygen-examples-complete.R | 152 ------------------ 31 files changed, 162 insertions(+), 152 deletions(-) create mode 100755 .dev/gen_roxygen_tests.R create mode 100644 tests/testthat/test-roxygen-examples-complete-01.R create mode 100644 tests/testthat/test-roxygen-examples-complete-02.R create mode 100644 tests/testthat/test-roxygen-examples-complete-03.R create mode 100644 tests/testthat/test-roxygen-examples-complete-04.R create mode 100644 tests/testthat/test-roxygen-examples-complete-05.R create mode 100644 tests/testthat/test-roxygen-examples-complete-06.R create mode 100644 tests/testthat/test-roxygen-examples-complete-07.R create mode 100644 tests/testthat/test-roxygen-examples-complete-08.R create mode 100644 tests/testthat/test-roxygen-examples-complete-09.R create mode 100644 tests/testthat/test-roxygen-examples-complete-10.R create mode 100644 tests/testthat/test-roxygen-examples-complete-11.R create mode 100644 tests/testthat/test-roxygen-examples-complete-12.R create mode 100644 tests/testthat/test-roxygen-examples-complete-13.R create mode 100644 tests/testthat/test-roxygen-examples-complete-14.R create mode 100644 tests/testthat/test-roxygen-examples-complete-15.R create mode 100644 tests/testthat/test-roxygen-examples-complete-16.R create mode 100644 tests/testthat/test-roxygen-examples-complete-17.R create mode 100644 tests/testthat/test-roxygen-examples-complete-18.R create mode 100644 tests/testthat/test-roxygen-examples-complete-19.R create mode 100644 tests/testthat/test-roxygen-examples-complete-20.R create mode 100644 tests/testthat/test-roxygen-examples-complete-21.R create mode 100644 tests/testthat/test-roxygen-examples-complete-22.R create mode 100644 tests/testthat/test-roxygen-examples-complete-23.R create mode 100644 tests/testthat/test-roxygen-examples-complete-24.R create mode 100644 tests/testthat/test-roxygen-examples-complete-25.R create mode 100644 tests/testthat/test-roxygen-examples-complete-26.R create mode 100644 tests/testthat/test-roxygen-examples-complete-27.R create mode 100644 tests/testthat/test-roxygen-examples-complete-28.R create mode 100644 tests/testthat/test-roxygen-examples-complete-29.R delete mode 100644 tests/testthat/test-roxygen-examples-complete.R diff --git a/.dev/gen_roxygen_tests.R b/.dev/gen_roxygen_tests.R new file mode 100755 index 000000000..71866d057 --- /dev/null +++ b/.dev/gen_roxygen_tests.R @@ -0,0 +1,17 @@ +#!/usr/bin/Rscript +# execute from package TLD: ./.dev/gen_roxygen_tests.R +all_examples <- list.files("tests/testthat/roxygen-examples-complete", full.names = TRUE) +unique_tests <- unique(sub("-.*", "", basename(all_examples))) + +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 "" + 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 + )) +} 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..dcc7bc42f --- /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_warning(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), NA) +}) 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) -}) From ecfed101c32c15e5cfcca77c6479c94b40e47a94 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 21 May 2023 19:23:02 -0700 Subject: [PATCH 2/6] use feedback --- .dev/gen_roxygen_tests.R | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.dev/gen_roxygen_tests.R b/.dev/gen_roxygen_tests.R index 71866d057..88e2f6eb9 100755 --- a/.dev/gen_roxygen_tests.R +++ b/.dev/gen_roxygen_tests.R @@ -1,16 +1,23 @@ #!/usr/bin/Rscript # execute from package TLD: ./.dev/gen_roxygen_tests.R -all_examples <- list.files("tests/testthat/roxygen-examples-complete", full.names = TRUE) -unique_tests <- unique(sub("-.*", "", basename(all_examples))) +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" 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 "" + out_file <- file.path("tests", "testthat", paste0("test-", roxygen_stub, "-", test, ".R")) + extras <- if (test %in% tests_scope_spaces) ', scope = "spaces"' else "" 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), + sprintf('test_that("analogous to test-%s: %s", {', roxygen_stub, test), + sprintf( + ' expect_warning(test_collection("%s", "^%s-", transformer = style_text%s), NA)', + roxygen_stub, test, extras + ), "})", NULL )) From 037dc472a870bfbbbbb5820c015634c54f65d014 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 21 May 2023 19:42:27 -0700 Subject: [PATCH 3/6] missed warning test in 23 --- .dev/gen_roxygen_tests.R | 6 ++++-- tests/testthat/test-roxygen-examples-complete-23.R | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.dev/gen_roxygen_tests.R b/.dev/gen_roxygen_tests.R index 88e2f6eb9..9acb681af 100755 --- a/.dev/gen_roxygen_tests.R +++ b/.dev/gen_roxygen_tests.R @@ -7,6 +7,8 @@ unique_tests <- unique(sub("-.*", "", all_examples)) # tests using 'scope = "spaces"' in test_collection() tests_scope_spaces <- "15" +warning_map <- c(`23` = '"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 "" @@ -15,8 +17,8 @@ for (test in unique_tests) { "", sprintf('test_that("analogous to test-%s: %s", {', roxygen_stub, test), sprintf( - ' expect_warning(test_collection("%s", "^%s-", transformer = style_text%s), NA)', - roxygen_stub, test, extras + ' expect_warning(test_collection("%s", "^%s-", transformer = style_text%s), %s)', + roxygen_stub, test, extras, warning_map[test] ), "})", NULL diff --git a/tests/testthat/test-roxygen-examples-complete-23.R b/tests/testthat/test-roxygen-examples-complete-23.R index dcc7bc42f..ce931abe3 100644 --- a/tests/testthat/test-roxygen-examples-complete-23.R +++ b/tests/testthat/test-roxygen-examples-complete-23.R @@ -1,5 +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) + expect_warning(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), "issues/1242") }) From 0f58421a442ed38f893a018842e5c7605f906cf2 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 21 May 2023 22:17:54 -0700 Subject: [PATCH 4/6] error not warning --- .dev/gen_roxygen_tests.R | 8 +++++--- tests/testthat/test-roxygen-examples-complete-23.R | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.dev/gen_roxygen_tests.R b/.dev/gen_roxygen_tests.R index 9acb681af..01ce7e436 100755 --- a/.dev/gen_roxygen_tests.R +++ b/.dev/gen_roxygen_tests.R @@ -7,18 +7,20 @@ unique_tests <- unique(sub("-.*", "", all_examples)) # tests using 'scope = "spaces"' in test_collection() tests_scope_spaces <- "15" -warning_map <- c(`23` = '"issues/1242"') +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_warning(test_collection("%s", "^%s-", transformer = style_text%s), %s)', - roxygen_stub, test, extras, warning_map[test] + ' 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-23.R b/tests/testthat/test-roxygen-examples-complete-23.R index ce931abe3..ce1b5833a 100644 --- a/tests/testthat/test-roxygen-examples-complete-23.R +++ b/tests/testthat/test-roxygen-examples-complete-23.R @@ -1,5 +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), "issues/1242") + expect_error(test_collection("roxygen-examples-complete", "^23-", transformer = style_text), "issues/1242") }) From 8337f15f351126352bfe8806f8ee6ac8669a0959 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Sun, 21 May 2023 22:27:25 -0700 Subject: [PATCH 5/6] missing .Rbuildignore entry --- .Rbuildignore | 1 + 1 file changed, 1 insertion(+) 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$ From 1288cccfa06b6c0bfc79f57bcc8a5fdc89e24ea8 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 3 Dec 2023 16:39:12 +0100 Subject: [PATCH 6/6] move generation script to `tests/dev` folder --- {.dev => tests/dev}/gen_roxygen_tests.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {.dev => tests/dev}/gen_roxygen_tests.R (94%) diff --git a/.dev/gen_roxygen_tests.R b/tests/dev/gen_roxygen_tests.R similarity index 94% rename from .dev/gen_roxygen_tests.R rename to tests/dev/gen_roxygen_tests.R index 01ce7e436..d260e4797 100755 --- a/.dev/gen_roxygen_tests.R +++ b/tests/dev/gen_roxygen_tests.R @@ -1,5 +1,5 @@ #!/usr/bin/Rscript -# execute from package TLD: ./.dev/gen_roxygen_tests.R +# 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))