From 27c11f69bd5bb08a23c03267e918c1ed30e5ccf4 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Mon, 14 Nov 2022 14:27:13 +0100 Subject: [PATCH] Test cache invalidation with basename rather than path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid these problems on Windows platforms: ``` actual vs expected - "../../../../../../../../../RCompile/CRANpkg/local/4.3/pkgload.Rcheck/tests/testthat/testHelp/man/foofoo.Rd" + "foofoo.Rd" ── Failure ('test-help.R:85'): shim_help and shim_questions works if topic moves ── rel_rd_path(shim_question("foofoo")) (`actual`) not equal to "foofoo.Rd" (`expected`). actual vs expected - "../../../../../../../../../RCompile/CRANpkg/local/4.3/pkgload.Rcheck/tests/testthat/testHelp/man/foofoo.Rd" + "foofoo.Rd" ── Failure ('test-help.R:93'): shim_help and shim_questions works if topic moves ── rel_rd_path(shim_help("foofoo")) (`actual`) not equal to "barbar.Rd" (`expected`). actual vs expected - "../../../../../../../../../RCompile/CRANpkg/local/4.3/pkgload.Rcheck/tests/testthat/testHelp/man/barbar.Rd" + "barbar.Rd" ── Failure ('test-help.R:94'): shim_help and shim_questions works if topic moves ── rel_rd_path(shim_question("foofoo")) (`actual`) not equal to "barbar.Rd" (`expected`). actual vs expected - "../../../../../../../../../RCompile/CRANpkg/local/4.3/pkgload.Rcheck/tests/testthat/testHelp/man/barbar.Rd" + "barbar.Rd" ``` --- NEWS.md | 3 +++ tests/testthat/test-help.R | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1ec76a8c..ef1d2944 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # pkgload (development version) +* Fixes for CRAN checks. + + # pkgload 1.3.1 * `dev_topic_find()` is now exported (#215). diff --git a/tests/testthat/test-help.R b/tests/testthat/test-help.R index ba6b3fca..0802b2b9 100644 --- a/tests/testthat/test-help.R +++ b/tests/testthat/test-help.R @@ -77,12 +77,10 @@ test_that("shim_help and shim_questions works if topic moves", { on.exit(unload(test_path('testHelp'))) path_man <- test_path("testHelp/man/") - rel_rd_path <- function(x) { - as.character(fs::path_rel(x$path, path_man)) - } + base_rd_path <- function(x) basename(x$path) - expect_equal(rel_rd_path(shim_help("foofoo")), "foofoo.Rd") - expect_equal(rel_rd_path(shim_question("foofoo")), "foofoo.Rd") + expect_equal(base_rd_path(shim_help("foofoo")), "foofoo.Rd") + expect_equal(base_rd_path(shim_question("foofoo")), "foofoo.Rd") fs::file_move(fs::path(path_man, "foofoo.Rd"), fs::path(path_man, "barbar.Rd")) on.exit( @@ -90,8 +88,8 @@ test_that("shim_help and shim_questions works if topic moves", { add = TRUE ) - expect_equal(rel_rd_path(shim_help("foofoo")), "barbar.Rd") - expect_equal(rel_rd_path(shim_question("foofoo")), "barbar.Rd") + expect_equal(base_rd_path(shim_help("foofoo")), "barbar.Rd") + expect_equal(base_rd_path(shim_question("foofoo")), "barbar.Rd") }) test_that("dev_help works with package and function help with the same name", {