make DateTest less fragile on CI servers

Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/0da49518
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/0da49518
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/0da49518

Branch: refs/heads/GROOVY_2_4_X
Commit: 0da4951802ae81465fe4ef7683eae66de469227c
Parents: 1cffb7a
Author: paulk <pa...@asert.com.au>
Authored: Sat Oct 24 11:38:47 2015 +1000
Committer: pascalschumacher <pascalschumac...@gmx.net>
Committed: Sat Oct 24 15:42:32 2015 +0200

----------------------------------------------------------------------
 src/test/groovy/DateTest.groovy | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/0da49518/src/test/groovy/DateTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/DateTest.groovy b/src/test/groovy/DateTest.groovy
index f20279c..3c2034d 100644
--- a/src/test/groovy/DateTest.groovy
+++ b/src/test/groovy/DateTest.groovy
@@ -42,12 +42,14 @@ class DateTest extends GroovyTestCase {
     }
 
     void testDateNextPrevious() {
+        def tz = TimeZone.default
         def x = new Date()
         def y = x + 2
         assert x < y
+        def crossedDaylightSavingBoundary = tz.inDaylightTime(x) ^ 
tz.inDaylightTime(y)
         ++x
         --y
-        assert x == y
+        if (!crossedDaylightSavingBoundary) assert x == y
         x += 2
         assert x > y
     }

Reply via email to