context("init")
test_that("creates a default skeleton", {
path <- new_tempdir()
expect_message(init_package("mypackage", path = path))
path <- file.path(path, "mypackage")
print(path)
expect_exists(file.path(path, ".git"))
expect_exists(file.path(path, "tests"))
expect_exists(file.path(path, "tests", "testthat", "test-example.R"))
expect_exists(file.path(path, "DESCRIPTION"))
expect_exists(file.path(path, "R", "please-change.R"))
expect_exists(file.path(path, "man", "hello_recon.Rd"))
expect_exists(file.path(path, "vignettes", "overview.Rmd"))
expect_exists(file.path(path, "README.Rmd"))
expect_exists(file.path(path, "CODE_OF_CONDUCT.md"))
expect_exists(file.path(path, ".travis.yml"))
expect_exists(file.path(path, "appveyor.yml"))
expect_exists(file.path(path, ".lintr"))
expect_exists(file.path(path, ".gitignore"))
expect_exists(file.path(path, ".Rbuildignore"))
expect_exists(file.path(path, "NAMESPACE"))
expect_exists(file.path(path, "NEWS.md"))
expect_exists(file.path(path, "README.md"))
expect_true(devtools::build_vignettes(path))
})
test_that("check if name is already taken on CRAN", {
path <- new_tempdir()
expect_error(init_package("Rcpp", path))
})
test_that("it fails if the pkg name is not valid", {
expect_error(init_package("", path))
expect_error(init_package(c("wat", "wat2"), path))
expect_error(init_package("asd_asd", path))
expect_error(init_package("asd asd", path))
expect_error(init_package("123123asd", path))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.