[Pkg] The Trunk: Chronology-Tests-pre.4.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Aug 17 08:40:44 UTC 2016
Patrick Rein uploaded a new version of Chronology-Tests to project The Trunk:
http://source.squeak.org/trunk/Chronology-Tests-pre.4.mcz
==================== Summary ====================
Name: Chronology-Tests-pre.4
Author: pre
Time: 17 August 2016, 10:40:34.494232 am
UUID: bb438ab5-6837-d74f-9036-cfb85ef62bf7
Ancestors: Chronology-Tests-bf.3
Updates makeUTC test for Dates to cater for the timezone independent behavior of Date objects. (together with Marcel)
=============== Diff against Chronology-Tests-bf.3 ===============
Item was changed:
----- Method: DateTest>>testMakeUTC (in category 'testing') -----
testMakeUTC
+ "Equal dates should compare equal regardless of which TimeZone they are created in."
+
+ | priorTz march31stLocal march31stOcean |
- "Equal dates should compare equal regardless of which TimeZone
- they are created in."
- | priorTz march31stLocal march31stOcean |
- "This test won't work in GMT-9, but nobody lives there."
- self deny: DateAndTime localTimeZone offset hours = -9.
priorTz := DateAndTime localTimeZone.
+
+ [DateAndTime
+ localTimeZone: (TimeZone
+ offset: 9 hours
+ name: 'Early Test Countries'
+ abbreviation: 'Test Ocean Early').
+
+ march31stLocal := Date year: 2016 month: 3 day: 31.
+ march31stLocal start: (march31stLocal start offset: DateAndTime localTimeZone offset).
+
- march31stLocal := Date today.
DateAndTime
localTimeZone: (TimeZone
+ offset: -9 hours
+ name: 'Late Test Countries'
+ abbreviation: 'Test Ocean Late').
+
+ march31stOcean := Date year: 2016 month: 3 day: 31.
+ march31stOcean start: (march31stOcean start offset: DateAndTime localTimeZone offset).]
+ ensure: [DateAndTime localTimeZone: priorTz].
+
+ self
+ deny: march31stLocal = march31stOcean;
+ assert: march31stOcean > march31stLocal.
+
+ self
+ assert: march31stLocal makeUTC = march31stOcean makeUTC;
+ deny: march31stOcean makeUTC > march31stLocal makeUTC;
+ deny: march31stOcean makeUTC < march31stLocal makeUTC.!
- offset: -9 hours
- name: 'No Countries'
- abbreviation: 'Ocean').
- march31stOcean := Date today.
- DateAndTime localTimeZone: priorTz.
- self assert: march31stLocal makeUTC = march31stOcean makeUTC ;
- deny: march31stOcean makeUTC > march31stLocal makeUTC ;
- deny: march31stOcean makeUTC < march31stLocal makeUTC!
More information about the Packages
mailing list