Skip to content

Commit

Permalink
test roclet clean
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonynorth committed Jul 31, 2023
1 parent bce357b commit 9afcdf9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/testthat/test-global_roclet.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ test_that("global_roclet() writes unique globals", {
test_that("global_roclet() writes to custom filename", {
pkg_path <- local_package_copy(test_path("./config-filename"))
globals_file <- file.path(pkg_path, "R", "generated-globals.R")
on.exit(unlink(globals_file))

suppressMessages(roxygen2::roxygenise(pkg_path))

Expand All @@ -94,3 +93,21 @@ test_that("global_roclet() writes to custom filename", {
)
)
})

test_that("global_roclet() cleans globals file", {
pkg_path <- local_package_copy(test_path("./empty"))
globals_file <- file.path(pkg_path, "R", "globals.R")

roxygen2::roclet_clean(global_roclet(), pkg_path)
expect_false(
file.exists(globals_file)
)

# ensure file exists
suppressMessages(roxygen2::roxygenise(pkg_path, clean = TRUE))

roxygen2::roclet_clean(global_roclet(), pkg_path)
expect_false(
file.exists(globals_file)
)
})

0 comments on commit 9afcdf9

Please sign in to comment.