Skip to content

Commit dfa2532

Browse files
committed
Modify test_simple.R to accommodate more oddness on one platform
1 parent 48f2b68 commit dfa2532

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

inst/tinytest/test_simple.R

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

22
isSolaris <- Sys.info()[["sysname"]] == "SunOS"
33
isWindows <- Sys.info()[["sysname"]] == "Windows"
4+
isMacOS <- Sys.info()[["sysname"]] == "Darwin" # not needed for winbuilder or r-univere but M1mac
45
isFedora <- anytime:::.isFedora()
6+
isWinOrMac <- isWindows || isMacOS
57

68
## We turn off tests on Solaris with some regret, yet firmly, as the
79
## combined inability of CRAN to provide us a test platform (to
@@ -47,45 +49,45 @@ if (isStupid) exit_file("Skipping Stupid (2 of 2)")
4749

4850
## Dates: Integer
4951
expect_equivalent(refD, anydate(20160101L + 0:2))
50-
if (!isWindows) expect_equal(refT, anytime(20160101L + 0:2, oldHeuristic=TRUE), check.tzone=FALSE)
52+
if (!isWinOrMac) expect_equal(refT, anytime(20160101L + 0:2, oldHeuristic=TRUE), check.tzone=FALSE)
5153

5254
## Dates: Numeric
5355
expect_equivalent(refD, anydate(20160101 + 0:2))
54-
if (!isWindows) expect_equal(refT, anytime(20160101 + 0:2, oldHeuristic=TRUE), check.tzone=FALSE)
56+
if (!isWinOrMac) expect_equal(refT, anytime(20160101 + 0:2, oldHeuristic=TRUE), check.tzone=FALSE)
5557

5658
## Dates: Factor
5759
expect_equivalent(refD, anydate(as.factor(20160101 + 0:2)))
58-
if (!isWindows) expect_equal(refT, anytime(as.factor(20160101 + 0:2)), check.tzone=FALSE)
60+
if (!isWinOrMac) expect_equal(refT, anytime(as.factor(20160101 + 0:2)), check.tzone=FALSE)
5961

6062
## Dates: Ordered
6163
expect_equivalent(refD, anydate(as.ordered(20160101 + 0:2)))
62-
if (!isWindows) expect_equal(refT, anytime(as.ordered(20160101 + 0:2)), check.tzone=FALSE)
64+
if (!isWinOrMac) expect_equal(refT, anytime(as.ordered(20160101 + 0:2)), check.tzone=FALSE)
6365

6466
## Dates: Character
6567
expect_equivalent(refD, anydate(as.character(20160101 + 0:2)))
66-
if (!isWindows) expect_equal(refT, anytime(as.character(20160101 + 0:2)), check.tzone=FALSE)
68+
if (!isWinOrMac) expect_equal(refT, anytime(as.character(20160101 + 0:2)), check.tzone=FALSE)
6769

6870
## Dates: alternate formats
6971
expect_equivalent(refD, anydate(c("20160101", "2016/01/02", "2016-01-03")))
70-
if (!isWindows) expect_equal(refT, anytime(c("20160101", "2016/01/02", "2016-01-03")), check.tzone=FALSE)
72+
if (!isWinOrMac) expect_equal(refT, anytime(c("20160101", "2016/01/02", "2016-01-03")), check.tzone=FALSE)
7173

7274
## Datetime: ISO with/without fractional seconds
7375
refPt <- as.POSIXct(as.POSIXlt(c("2016-01-01 10:11:12", "2016-01-01 10:11:12.345678")))
74-
if (!isWindows) expect_equal(refPt, anytime(c("2016-01-01 10:11:12", "2016-01-01 10:11:12.345678")), check.tzone=FALSE)
76+
if (!isWinOrMac) expect_equal(refPt, anytime(c("2016-01-01 10:11:12", "2016-01-01 10:11:12.345678")), check.tzone=FALSE)
7577

7678
## Datetime: ISO alternate (?) with 'T' separator
7779
## Only works with ' '
78-
if (!isWindows) expect_equal(refPt, anytime(c("20160101 101112", "20160101 101112.345678")), check.tzone=FALSE)
80+
if (!isWinOrMac) expect_equal(refPt, anytime(c("20160101 101112", "20160101 101112.345678")), check.tzone=FALSE)
7981

8082
## Datetime: textual month formats
8183
ref3 <- rep(as.POSIXct(as.POSIXlt("2016-09-01 10:11:12")), 3)
82-
if (!isWindows) expect_equal(ref3,
83-
anytime(c("2016-Sep-01 10:11:12", "Sep/01/2016 10:11:12",
84-
"Sep-01-2016 10:11:12")), check.tzone=FALSE)
84+
if (!isWinOrMac) expect_equal(ref3,
85+
anytime(c("2016-Sep-01 10:11:12", "Sep/01/2016 10:11:12",
86+
"Sep-01-2016 10:11:12")), check.tzone=FALSE)
8587

8688
## Datetime: Mixed format (cf http://stackoverflow.com/questions/39259184)
87-
if (!isWindows) expect_equal(refPt,
88-
anytime(c("Thu Jan 01 10:11:12 2016", "Thu Jan 01 10:11:12.345678 2016")), check.tzone=FALSE)
89+
if (!isWinOrMac) expect_equal(refPt,
90+
anytime(c("Thu Jan 01 10:11:12 2016", "Thu Jan 01 10:11:12.345678 2016")), check.tzone=FALSE)
8991

9092
## Datetime: pre/post DST
9193
anytime(c("2016-01-31 12:13:14", "2016-08-31 12:13:14"))

0 commit comments

Comments
 (0)