Skip to content

Commit 6410f43

Browse files
committed
refined test.Datetime.formatting for Windoze
1 parent 24bc301 commit 6410f43

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

ChangeLog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* src/Date.cpp (Rcpp): Protect assignment to tm_gmtoff to not being
44
under MinGW; could potentially bite other too-limited systems
55

6-
* inst/unitTests/runit.Date.R (test.Datetime.formating): Condition one
7-
test out if on Windows
6+
* inst/unitTests/runit.Date.R (test.Datetime.formating): Do not set TZ
7+
when running test, only set digits option
88

99
2017-01-01 Dirk Eddelbuettel <[email protected]>
1010

inst/unitTests/runit.Date.R

100644100755
Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -217,27 +217,21 @@ if (.runThisTest) {
217217
}
218218

219219
test.Datetime.formating <- function() {
220-
if (Sys.info()[["sysname"]] != "Windows") {
221-
oldTZ <- Sys.getenv("TZ")
222-
Sys.setenv(TZ="America/Chicago")
223-
224-
olddigits <- getOption("digits.secs")
225-
options("digits.secs"=6)
226-
227-
d <- as.POSIXct("2016-12-13 14:15:16.123456")
228-
checkEquals(Datetime_format(d,"%Y-%m-%d %H:%M:%S"),
229-
format(d, "%Y-%m-%d %H:%M:%OS"),
230-
msg="Datetime.formating.default")
231-
checkEquals(Datetime_format(d, "%Y/%m/%d %H:%M:%S"),
232-
format(d, "%Y/%m/%d %H:%M:%OS"),
233-
msg="Datetime.formating.given.format")
234-
checkEquals(Datetime_ostream(d),
235-
format(d, "%Y-%m-%d %H:%M:%OS"),
236-
msg="Datetime.formating.ostream")
237-
238-
Sys.setenv(TZ=oldTZ)
239-
options("digits.secs"=olddigits)
240-
}
220+
olddigits <- getOption("digits.secs")
221+
options("digits.secs"=6)
222+
223+
d <- as.POSIXct("2016-12-13 14:15:16.123456")
224+
checkEquals(Datetime_format(d,"%Y-%m-%d %H:%M:%S"),
225+
format(d, "%Y-%m-%d %H:%M:%OS"),
226+
msg="Datetime.formating.default")
227+
checkEquals(Datetime_format(d, "%Y/%m/%d %H:%M:%S"),
228+
format(d, "%Y/%m/%d %H:%M:%OS"),
229+
msg="Datetime.formating.given.format")
230+
checkEquals(Datetime_ostream(d),
231+
format(d, "%Y-%m-%d %H:%M:%OS"),
232+
msg="Datetime.formating.ostream")
233+
234+
options("digits.secs"=olddigits)
241235
}
242236

243237

0 commit comments

Comments
 (0)