Skip to content

Commit

Permalink
Update export_help tests to expect_equal
Browse files Browse the repository at this point in the history
  • Loading branch information
elimillera committed Apr 26, 2023
1 parent e579390 commit 1e062ae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/testthat/test_assess_export_help.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Commenting these out until this is implemented for sourced packages
test_that("assess_export_help returns expected result for source packages", {
expect_true(assess_source_good$export_help[[1]])
expect_true(assess_install_good$export_help[[1]])
expect_true(assess_source_bad$export_help[[1]])

expect_equal(unname(assess_source_good$export_help), c(TRUE))
expect_equal(unname(assess_install_good$export_help), c(TRUE))

expect_equal(unname(assess_source_bad$export_help), c(FALSE, TRUE))
expect_equal(unname(assess_install_bad$export_help), c(FALSE, TRUE))

expect_true(assess_stdlibs_install$export_help[[1]][[1]])

expect_true(is.numeric(score_install_good$export_help))
expect_true(is.numeric(score_source_bad$export_help))
expect_true(is.numeric(score_source_good$export_help))
expect_equal(score_install_good$export_help[[1]], 1)
expect_equal(score_install_bad$export_help[[1]], 0.5)
expect_equal(score_source_bad$export_help[[1]], 0.5)
expoct_equal(score_source_good$export_help[[1]], 1)
})
1 change: 1 addition & 0 deletions tests/testthat/test_packages/pkgsourcebad/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Generated by roxygen2: do not edit by hand

export(hello_work_test_2)
export(hello_world_test)
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@
hello_world_test <- function(x) {
print(paste0("hello world", x))
}

#' A Test Function with no help docs
#' @export
#' @noRd
hello_work_test_2 <- function(x) {
print(paste0("hello world", x))
}

0 comments on commit 1e062ae

Please sign in to comment.