tests/testthat/test-saveRdExamples.R

test_that("saveRdExamples", {
    rd <- c("do.call", "droplevels")
    testdir <- file.path(tempdir(), "testdata")
    unlink(testdir, recursive = TRUE)
    out <- saveRdExamples(
        rd = rd,
        package = "base",
        dir = testdir
    )
    expect_identical(
        object = basename(out),
        expected = paste0(rd, ".R")
    )
    expect_identical(
        object = sort(list.files(
            path = testdir,
            pattern = "*.R",
            full.names = FALSE,
            recursive = FALSE
        )),
        expected = paste0(rd, ".R")
    )
    unlink(testdir, recursive = TRUE)
})
mjsteinbaugh/devtools documentation built on Jan. 5, 2024, 11:09 a.m.