From 52ec2f68321f3eda2731900809d0fd976f736e3e Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Tue, 11 Apr 2023 17:04:32 -0500 Subject: [PATCH] Test for and suppress expected warning during test --- inst/tinytest/test-tclass.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inst/tinytest/test-tclass.R b/inst/tinytest/test-tclass.R index ca63f5f1..92b97262 100644 --- a/inst/tinytest/test-tclass.R +++ b/inst/tinytest/test-tclass.R @@ -63,4 +63,5 @@ expect_equal(target, tclass(y)) info_msg <- "tclass() on object with no tclass/.indexCLASS returns POSIXct" x <- structure(1:5, .Dim = c(5L, 1L), index = 1:5, class = c("xts", "zoo")) -expect_identical(c("POSIXct", "POSIXt"), tclass(x)) +expect_warning(xtc <- tclass(x), "index does not have a 'tclass' attribute") +expect_identical(c("POSIXct", "POSIXt"), xtc)