R Under development (unstable) (2024-12-19 r87451 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(iso8601) > source("helpers.R") > > x <- c("2024-01-01T12:34", "2024W011", "2024-123T13:00:00+01", "T1530", NA) > > expect_equal(iso8601standardise(x), + c("2024-01-01T12:34:00", "2024-01-01", "2024-05-02T12:00:00Z", + "T15:30:00", NA)) > expect_equal(iso8601standardise(x, fillmissing = FALSE), + c("2024-01-01T12:34", "2024-01-01", "2024-05-02T12:00:00Z", + "T15:30", NA)) > expect_equal(iso8601standardise(x, toymd = FALSE), + c("2024-01-01T12:34:00", "2024-W01-1", "2024-123T12:00:00Z", + "T15:30:00", NA)) > expect_equal(iso8601standardise(x, tozulu = FALSE), + c("2024-01-01T12:34:00", "2024-01-01", "2024-05-02T13:00:00+01:00", + "T15:30:00", NA)) > expect_equal(iso8601standardise(x, tozulu = FALSE, fillmissing = FALSE), + c("2024-01-01T12:34", "2024-01-01", "2024-05-02T13:00:00+01:00", + "T15:30", NA)) > expect_equal(iso8601standardise(x, tozulu = FALSE, toymd = FALSE), + c("2024-01-01T12:34:00", "2024-W01-1", "2024-123T13:00:00+01:00", + "T15:30:00", NA)) > expect_equal(iso8601standardise(x, tozulu = FALSE, toymd = FALSE, + fillmissing = FALSE), + c("2024-01-01T12:34", "2024-W01-1", "2024-123T13:00:00+01:00", + "T15:30", NA)) > > expect_warning(x <- iso8601standardise(c("2024-01", "FOO"))) > expect_equal(x, c("2024-01-01", NA)) > > > # Following resulted in segfault in earlier version > expect_error(iso8601standardise("2024", "foo")) > > proc.time() user system elapsed 0.17 0.07 0.25