Skip to content

Commit 6771731

Browse files
committed
write unit tests for unhappy path
1 parent 4a17212 commit 6771731

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/testthat/test-smk-colnamesDS.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,24 @@ test_that("simple colnamesDS, data.matrix", {
4242
expect_true("v2" %in% res)
4343
})
4444

45+
test_that("colnamesDS throws error when object does not exist", {
46+
expect_error(
47+
colnamesDS("nonexistent_object"),
48+
regexp = "does not exist"
49+
)
50+
})
51+
52+
test_that("colnamesDS throws error when object is not data.frame or matrix", {
53+
bad_input <- list(a = 1:3, b = 4:6)
54+
expect_error(
55+
colnamesDS("bad_input"),
56+
regexp = "must be of type data.frame or matrix"
57+
)
58+
})
59+
4560
#
4661
# Done
4762
#
4863

4964
context("colnamesDS::smk::shutdown")
50-
5165
context("colnamesDS::smk::done")

0 commit comments

Comments
 (0)