Skip to content

Commit 8d59871

Browse files
committed
add test for error message
1 parent c7d8485 commit 8d59871

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/testthat/test-ppc-censoring.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ test_that("ppc_km_overlay_grouped returns a ggplot object", {
3232
status_y = status_y2))
3333
})
3434

35+
test_that("ppc_km_overlay errors if bad left_truncation_y value", {
36+
skip_if_not_installed("ggfortify")
37+
expect_error(
38+
ppc_km_overlay(y, yrep, status_y = status_y, left_truncation_y = "a"),
39+
"`left_truncation_y` must be a numeric vector of the same length as `y`"
40+
)
41+
expect_error(
42+
ppc_km_overlay(y, yrep, status_y = status_y, left_truncation_y = 1:10),
43+
"`left_truncation_y` must be a numeric vector of the same length as `y`"
44+
)
45+
})
46+
3547
# Visual tests -----------------------------------------------------------------
3648

3749
test_that("ppc_km_overlay renders correctly", {

0 commit comments

Comments
 (0)