Skip to content

Commit

Permalink
Update code coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
gfinak committed Sep 10, 2018
1 parent 18a42a9 commit 6567f12
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/processData.R
Expand Up @@ -567,7 +567,7 @@ DataPackageR <- function(arg = NULL, deps = TRUE) {
.ppfiles_mkvignettes <- function(dir = NULL) {
cat("\n")
if (proj_get() != dir) {
usethis::proj_set(dir)
usethis::proj_set(dir) #nocov
}
pkg <- desc::desc(dir)
pkg$set_dep("knitr", "Suggests")
Expand Down
2 changes: 1 addition & 1 deletion R/prompt.R
Expand Up @@ -4,7 +4,7 @@
interactive()
)) {
if (interactive()&interact) {
cat(crayon::cyan("Enter a text description of the changes for the NEWS.md file.\n")) # nolint
cat(crayon::cyan("Enter a text description of the changes for the NEWS.md file.\n")) #nocov
}else{
cat(crayon::cyan("Non-interactive NEWS.md file update.\n"))
}
Expand Down
2 changes: 1 addition & 1 deletion R/use.R
Expand Up @@ -336,7 +336,7 @@ use_data_object <- function(object_name = NULL) {
yaml::yaml.load(string, ...)
}
else {
.mark_utf8(yaml::yaml.load(enc2utf8(string), ...))
.mark_utf8(yaml::yaml.load(enc2utf8(string), ...)) #nocov
}
}

Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/test-use_raw_data.R
Expand Up @@ -180,6 +180,12 @@ test_that(".partition_r_front_matter", {
DataPackageR:::.partition_r_front_matter(test_string2)$front_matter,
NULL
)

expect_equal(DataPackageR:::.partition_r_front_matter(
c("#' ---","author:Greg Finak","#' ---","body")),
list(front_matter = c("#' ---","author:Greg Finak","#' ---"),
body = "body"))

expect_equal(
is.null(
DataPackageR:::.partition_r_front_matter(test_string3)$body
Expand Down Expand Up @@ -259,6 +265,12 @@ test_that(".partition_rmd_front_matter", {
DataPackageR:::.partition_rmd_front_matter(test_string4)$front_matter,
NULL
)

expect_equal(DataPackageR:::.partition_rmd_front_matter(
c("---","author:Greg Finak","---","body")),
list(front_matter = c("---","author:Greg Finak","---"),
body = "body"))

expect_equal(
is.null(
DataPackageR:::.partition_rmd_front_matter(test_string5)$front_matter
Expand Down Expand Up @@ -306,6 +318,7 @@ test_that(".parse_yaml_front_matter", {
(DataPackageR:::.parse_yaml_front_matter(test_string6)),
list(input = "in", output = "out")
)
expect_equal(DataPackageR:::.parse_yaml_front_matter(c("foo:bar","yes:no","if:then")),list())
})

test_that(".mark_utf8", {
Expand All @@ -315,4 +328,6 @@ test_that(".mark_utf8", {

test_that(".is_blank", {
expect_true(DataPackageR:::.is_blank(x = ""))
expect_true(DataPackageR:::.is_blank(character(0)))
})

0 comments on commit 6567f12

Please sign in to comment.