Skip to content

Commit bdb5476

Browse files
committed
test: written tests for unhappy flow
1 parent 39949a9 commit bdb5476

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎tests/testthat/test-smk-ds.colnames.R‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test_that("setup", {
2323
#
2424
# Tests
2525
#
26-
26+
options(datashield.errors.print = TRUE)
2727
context("ds.colnames::smk")
2828
test_that("simple colnames", {
2929
myvectors <- c("D$LAB_TSC", "D$LAB_TRIG")
@@ -43,6 +43,22 @@ test_that("simple colnames", {
4343
expect_equal(res$sim3[2], "LAB_TRIG")
4444
})
4545

46+
test_that("fails if the object does not exist", {
47+
expect_error(
48+
ds.colnames("non_existing_df"),
49+
regexp = "'non_existing_df' does not exist",
50+
ignore.case = TRUE
51+
)
52+
})
53+
54+
test_that("fails if object is not a data frame or matrix", {
55+
expect_error(
56+
ds.colnames("D$LAB_TSC"),
57+
regexp = "must be of type data.frame or matrix",
58+
ignore.case = TRUE
59+
)
60+
})
61+
4662
#
4763
# Done
4864
#

0 commit comments

Comments
 (0)