Skip to content

Commit babcde2

Browse files
committed
ensure consistent POSIXct output across R versions
1 parent 80cab65 commit babcde2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/testthat/test-expect-comparison.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ test_that("comparisons with POSIXct objects work", {
6969
time2 <- time + 1.5
7070
expect_success(expect_lt(time, time2))
7171

72-
expect_snapshot_failure(expect_lt(time2, time))
72+
# set digits.secs = 1 to ensure consistent output with older R versions
73+
withr::with_options(c(digits.secs = 1), {
74+
expect_snapshot_failure(expect_lt(time2, time))
75+
})
7376
})
7477

7578
test_that("comparisons with Date objects work", {

0 commit comments

Comments
 (0)