The Trunk: Chronology-Tests-dtl.20.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Chronology-Tests-dtl.20.mcz

commits-2
David T. Lewis uploaded a new version of Chronology-Tests to project The Trunk:
http://source.squeak.org/trunk/Chronology-Tests-dtl.20.mcz

==================== Summary ====================

Name: Chronology-Tests-dtl.20
Author: dtl
Time: 27 January 2019, 6:02:53.312815 pm
UUID: 005bcc36-75cd-4ade-82b4-9cbef7dbf8fb
Ancestors: Chronology-Tests-dtl.19

Add TimespanTest>>testBeCanonical to document the behavior as implemented in Chronology prior to the recent UTC updates.

=============== Diff against Chronology-Tests-dtl.19 ===============

Item was added:
+ ----- Method: TimespanTest>>testBeCanonical (in category 'Tests') -----
+ testBeCanonical
+
+ | start ts1 ts2 ts3 |
+ start := '2019-01-27T17:11:40.061188-05:00' asDateAndTime.
+ ts1 := Timespan starting: start duration: 123456 seconds.
+ ts2 := ts1 deepCopy.
+ ts3 := ts2 beCanonical.
+ self assert: ts2
+ identical: ts3
+ description: 'beCanonical modifies the receiver, not a copy thereof'.
+ self deny: ts3 = ts1.
+ self assert: '2019-01-27T17:11:40.061188-05:00' asDateAndTime
+ equals: ts1 start
+ description: 'original timespan start is not modified'.
+ self assert: ts1 duration
+ equals: ts3 duration
+ description: 'duration does not change'.
+ self assert: '2019-01-27T17:11:40.061188+00:00' asDateAndTime
+ equals: ts3 start.
+ self deny: ts1 start = ts3 start
+ description: 'magnitude of start time is changed'.
+ self assert: 5 hours
+ equals: start - ts3 start
+ description: 'magnitude of start time is changed'.
+ self assert: 0 seconds
+ equals: ts3 start offset
+ description: 'time zone offset is zero'.
+ self assert: 5 hours negated
+ equals: ts1 start offset
+ description: 'original timezone was -18000'.
+ !