swh:1:snp:bdc19e867479541d0f4994ceaa711217d0dc28ed
Tip revision: 1ad2332a4119217014f512bdf05025fa6f2bb72f authored by Hadley Wickham on 09 April 2020, 13:00:02 UTC
version 1.5.1
version 1.5.1
Tip revision: 1ad2332
test-build-citation-authors.R
context("test-build-citation-authors.R")
# A CITATION file anywhere except in `inst/CITATION` is an R CMD check note
# so 'site-citation' is build-ignored, and so the tests must be skipped
# during R CMD check
path <- test_path("assets/site-citation/encoding-UTF-8")
skip_if_not(dir_exists(path)[[1]])
test_that("UTF-8 encoding and `citation(auto = meta) can be read` (#416, #493)", {
cit <- read_citation(path)
expect_is(cit, "citation")
})
test_that("latin1 encoding and `citation(auto = meta) can be read` (#689)", {
path <- test_path("assets/site-citation/encoding-latin1")
cit <- read_citation(path)
expect_is(cit, "citation")
})
test_that("create_meta can read DESCRIPTION with an Encoding", {
path <- test_path("assets/site-citation/encoding-UTF-8")
meta <- create_citation_meta(path)
expect_type(meta, "list")
expect_equal(meta$`Authors@R`, 'person(\"Florian\", \"Privé\")')
})
test_that("source link is added to citation page", {
path <- test_path("assets/site-citation/encoding-UTF-8")
expect_output(build_home(path))
on.exit(clean_site(path))
lines <- read_lines(path(path, "docs", "authors.html"))
expect_true(any(grepl("<code>inst/CITATION</code></a></small>", lines)))
})