@@ -106,6 +106,11 @@ test_that("use_tester works as expected", {
106106
107107
108108test_that(" use_test_subdir works as expected" , {
109+ # * @testing use_test_subdir
110+ # * @testing use_acceptance_tests
111+ # * @testing use_integration_tests
112+ # * @testing use_manual_tests
113+
109114 package_state <- list.files(" ." , recursive = TRUE )
110115 tpkg <- rprojroot :: find_testthat_root_file(" testdata" , " test_pkg" )
111116 usethis :: proj_set(tpkg )
@@ -118,22 +123,34 @@ test_that("use_test_subdir works as expected", {
118123 ),
119124 " Creating"
120125 )
121-
122126 edir <- file.path(tpkg , " tests" , " testthat" , " footests" )
123127 efile <- file.path(tpkg , " R" , " testthis-testers.R" )
124128
125129 expect_true(dir.exists(edir ))
126130 expect_true(file.exists(efile ))
127131 expect_true(file.size(efile ) > 10 )
128-
129- # cleanup
130132 unlink(efile )
131133 unlink(edir , recursive = TRUE )
132- expect_false(file.exists(efile ))
133- expect_false(file.exists(edir ))
134+
135+
136+ # Check if preset subdir creators work
137+ edir <- file.path(tpkg , " tests/testthat/integration_tests/" )
138+ expect_output(expect_true(use_integration_tests()), " Creating" )
139+ expect_true(file.exists(edir ))
140+ unlink(edir , recursive = TRUE )
141+
142+ edir <- file.path(tpkg , " tests/testthat/acceptance_tests/" )
143+ expect_output(expect_true(use_acceptance_tests()), " Creating" )
144+ expect_true(file.exists(file.path(tpkg , " tests/testthat/acceptance_tests/" )))
145+ unlink(edir , recursive = TRUE )
146+
147+ edir <- file.path(tpkg , " tests/testthat/manual_tests/" )
148+ expect_output(expect_true(use_manual_tests()), " Creating" )
149+ expect_true(file.exists(edir ))
150+ unlink(edir , recursive = TRUE )
151+
134152
135153 # Check for unexpected changes to package
136- package_state_new <- list.files(" ." , recursive = TRUE )
137- expect_identical(package_state , package_state_new )
154+ expect_identical(package_state , list.files(" ." , recursive = TRUE ))
138155 usethis :: proj_set(proj )
139156})
0 commit comments