From 6567f12543414a9d1c634739bec4856972ac08f4 Mon Sep 17 00:00:00 2001 From: gfinak Date: Mon, 10 Sep 2018 09:53:20 -0700 Subject: [PATCH] Update code coverage. --- R/processData.R | 2 +- R/prompt.R | 2 +- R/use.R | 2 +- tests/testthat/test-use_raw_data.R | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/R/processData.R b/R/processData.R index b5842cf..435ff51 100644 --- a/R/processData.R +++ b/R/processData.R @@ -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") diff --git a/R/prompt.R b/R/prompt.R index 4e08ee1..8e284e0 100644 --- a/R/prompt.R +++ b/R/prompt.R @@ -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")) } diff --git a/R/use.R b/R/use.R index dffd1a9..8ad0154 100644 --- a/R/use.R +++ b/R/use.R @@ -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 } } diff --git a/tests/testthat/test-use_raw_data.R b/tests/testthat/test-use_raw_data.R index 8824353..5fbed2a 100644 --- a/tests/testthat/test-use_raw_data.R +++ b/tests/testthat/test-use_raw_data.R @@ -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 @@ -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 @@ -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", { @@ -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))) }) +