[squeak-dev] The Inbox: Chronology-Tests-dtl.15.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jan 12 15:52:07 UTC 2019


David T. Lewis uploaded a new version of Chronology-Tests to project The Inbox:
http://source.squeak.org/inbox/Chronology-Tests-dtl.15.mcz

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

Name: Chronology-Tests-dtl.15
Author: dtl
Time: 12 January 2019, 10:52:06.856687 am
UUID: 93d70832-de59-4f2a-8516-b98262941370
Ancestors: Chronology-Tests-dtl.14

Add testGetSeconds to verify that getSeconds represents whole seconds in the local time zone. For a given instance of DateAndTime, changing the time zone offset changes the local representation, but does not affect magnitude (time since a defiined epoch). Therefore, if time zone offset changes, the asSeconds value should not change, and the getSeconds value should change to reflect local timezone.

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

Item was added:
+ ----- Method: DateAndTimeTest>>testGetSeconds (in category 'Tests') -----
+ testGetSeconds
+ 	"Verify that getSeconds represents whole seconds in the local time zone. For
+ 	a given instance of DateAndTime, changing the time zone offset changes the
+ 	local representation, but does not affect magnitude (time since a defiined
+ 	epoch). Therefore, if time zone offset changes, the asSeconds value should
+ 	not change, and the getSeconds value should change to reflect local timezone." 
+ 
+ 	| dt s1 id stSeconds seconds1 seconds2 |
+ 	s1 :=  '2019-01-12T10:07:05.18743-05:00'.
+ 	dt := s1 asDateAndTime.
+ 	self assert: 18000 seconds negated equals: dt offset.
+ 	seconds1 := dt getSeconds.
+ 	self assert: 36425 equals: seconds1.
+ 	id := dt identityHash.
+ 	stSeconds := dt asSeconds.
+ 	dt makeUTC. "make the receiver's timezone GMT, do not change magnitude"
+ 	self assert: id equals: dt identityHash. "same object, not a copy"
+ 	self assert: '2019-01-12T15:07:05.18743+00:00' equals: dt asString.
+ 	self assert: stSeconds equals: dt asSeconds. "magnitude unchanged"
+ 	self assert: '2019-01-12T10:07:05.18743-05:00' asDateAndTime equals: dt. "still equal"
+ 	seconds2 := dt getSeconds.
+ 	self deny: seconds1 equals: seconds2.
+ 	self assert: 54425 equals: seconds2.
+ 
+ !



More information about the Squeak-dev mailing list