Skip to content

Commit

Permalink
Raise coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Nov 8, 2018
1 parent 585727f commit f5af6be
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion R/commands.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ standardize_command <- function(x) {
braces(x)
}

# We won't need this function after #563.
language_to_text <- function(x) {
if (length(x) < 1) {
return(character(0))
return(character(0)) # nocov
}
if (is.expression(x)) {
# TODO: remove the if () clause in some major version bump.
Expand Down
2 changes: 1 addition & 1 deletion R/triggers.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ file_trigger <- function(target, meta, config) {
if (!length(target) || !length(config) || !length(meta)) {
return(FALSE)
}
file_out <- config$ordinances[[target]]$file_out
file_out <- config$ordinances[[target]]$deps_build$file_out
for (file in file_out) {
if (!file.exists(drake_unquote(file))) {
return(TRUE)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ test_with_dir("clean() removes the correct files", {
expect_false(file.exists("d.txt"))
})

test_with_dir("empty read_drake_plan()", {
expect_equal(
read_drake_plan(cache = storr::storr_environment()),
drake_plan()
)
})

test_with_dir("dependency profile", {
skip_on_cran() # CRAN gets whitelist tests only (check time limits).
b <- 1
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-intermediate-file.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ test_with_dir("responses to intermediate file", {
expect_equal(val, readRDS("intermediatefile.rds"))
expect_equal(val2, readRDS("out2.rds"))
}

# break a file
for (file in c("intermediatefile.rds", "out2.rds")) {
unlink(file, force = TRUE)
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ test_with_dir("file system", {
expect_equal(file_extn("a.b/c.d/e/f/g_h.i.j.k"), "k")
expect_equal(file_extn("123"), "123")
})

test_with_dir("merge_lists()", {
x <- list(a = 1, b = 1:2, c = 1:3)
y <- list(b = 3:4, c = 4:5, d = 1:5)
z <- merge_lists(x, y)
z <- lapply(z, sort)
w <- list(a = 1, b = 1:4, c = 1:5, d = 1:5)
expect_equal(z, w)
})

0 comments on commit f5af6be

Please sign in to comment.