Skip to content

Commit

Permalink
Simplify spell check test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Sep 14, 2024
1 parent d6f9984 commit 8b1666d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
19 changes: 0 additions & 19 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,6 @@ test_df <- function(tibble = FALSE, factor = FALSE, missing = FALSE) {
df
}

test_package_root <- function() {
skip_if_not_installed("rprojroot")
x <- tryCatch(
rprojroot::find_package_root_file(),
error = function(e) NULL)

if (!is.null(x)) return(x)

pkg <- testthat::testing_package()
x <- tryCatch(
rprojroot::find_package_root_file(
path = file.path("..", "..", "00_pkg_src", pkg)),
error = function(e) NULL)

if (!is.null(x)) return(x)

stop("Cannot find package root")
}

test_write <- function(d, schema = NULL, encoding = NULL) {
tmp <- tempfile(fileext = ".parquet")
on.exit(unlink(tmp), add = TRUE)
Expand Down
7 changes: 6 additions & 1 deletion tests/testthat/test-spelling.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
test_that("spelling", {
skip_on_cran()
skip_on_covr()
pkg <- test_package_root()

pkg <- test_path("../../")
if (!file.exists(file.path(pkg, "DESCRIPTION"))) {
pkg <- file.path(pkg, "00_pkg_src", .packageName)
}

expect_snapshot({
spelling::spell_check_package(pkg)
})
Expand Down

0 comments on commit 8b1666d

Please sign in to comment.