The Trunk: Chronology-Tests-dtl.18.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.18.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.18.mcz

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

Name: Chronology-Tests-dtl.18
Author: dtl
Time: 27 January 2019, 1:21:59.414215 pm
UUID: 5411396e-c5fc-4517-97ef-5cf9e7aa5dea
Ancestors: Chronology-Tests-pre.17

Do not use #makeUTC in DateAndTimeTest>>testGetSeconds because it modifies magnitude.

=============== Diff against Chronology-Tests-pre.17 ===============

Item was changed:
  ----- 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 localOffsetSeconds: 0. "make the receiver's timezone GMT, do not change magnitude"
- 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.
 
  !