Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Feb 5, 2025
1 parent c22491e commit ed2bb3a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/testthat/test-class_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ tar_test("builder metadata recording", {
expect_equal(nrow(db$read_data()), 1L)
})

tar_test("meta$set_record()", {
skip_cran()
out <- meta_init()
target <- target_init("x", quote(sample.int(100)))
pipeline <- pipeline_init(list(target), clone_targets = FALSE)
local <- local_init(pipeline)
local$run()
meta <- local$meta
db <- meta$database
db$ensure_storage()
expect_gt(nrow(db$read_data()), 0L)
db$reset_storage()
expect_equal(nrow(db$read_data()), 0L)
meta$database$lookup <- lookup_new()
expect_false(meta$exists_record("x"))
meta$set_record(target_produce_record(target, pipeline, meta))
expect_true(meta$exists_record("x"))
})

tar_test("meta$insert_row()", {
skip_cran()
out <- meta_init()
target <- target_init("x", quote(sample.int(100)))
pipeline <- pipeline_init(list(target), clone_targets = FALSE)
local <- local_init(pipeline)
local$run()
meta <- local$meta
db <- meta$database
db$ensure_storage()
expect_gt(nrow(db$read_data()), 0L)
db$reset_storage()
expect_equal(nrow(db$read_data()), 0L)
meta$database$lookup <- lookup_new()
expect_false(meta$exists_record("x"))
meta$insert_row(list(name = "x", data = "y"))
expect_true(meta$exists_record("x"))
})

tar_test("meta$record_imports()", {
envir <- new.env(parent = emptyenv())
envir$f <- function(x) g(x) + h(x)
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-tar_visnetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ tar_test("tar_visnetwork()", {
)
})
out <- tar_visnetwork(
label = c(
"description",
"time",
"size",
"branches"
),
callr_function = NULL,
callr_arguments = list(show = FALSE)
)
Expand Down

0 comments on commit ed2bb3a

Please sign in to comment.