Skip to content

Commit 9392029

Browse files
test for explicit file names
1 parent f7ef7d9 commit 9392029

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/testthat/test-public_api.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,24 @@ test_that("styler can style package", {
1010
})
1111

1212
test_that("styler can style package and exclude some directories", {
13-
capture_output(expect_true({
13+
capture_output(
1414
styled <- style_pkg(testthat_file("public-api", "xyzpackage"),
1515
exclude_dirs = "tests"
1616
)
17-
nrow(styled) == 1
18-
}))
17+
)
18+
expect_true(nrow(styled) == 1)
19+
expect_false(any(grepl("tests/testthat/test-package-xyz.R", styled$file)))
1920
})
2021

2122
test_that("styler can style package and exclude some sub-directories", {
22-
capture_output(expect_true({
23+
capture_output(
2324
styled <- style_pkg(testthat_file("public-api", "xyzpackage"),
2425
exclude_dirs = "tests/testthat"
2526
)
26-
nrow(styled) == 2
27-
}))
27+
)
28+
expect_true(nrow(styled) == 2)
29+
expect_true(any(grepl("tests/testthat.R", styled$file)))
30+
expect_false(any(grepl("tests/testthat/test-package-xyz.R", styled$file)))
2831
})
2932

3033

0 commit comments

Comments
 (0)