David T. Lewis uploaded a new version of Chronology-Tests to project The Treated Inbox: http://source.squeak.org/treated/Chronology-Tests-dtl.33.mcz
==================== Summary ====================
Name: Chronology-Tests-dtl.33 Author: dtl Time: 18 June 2023, 12:54:08.985243 pm UUID: cda186b6-d5ac-4a95-bc15-373c7a4a645b Ancestors: Chronology-Tests-dtl.32
Establish protocol for aTimeZone offsetAt: aDateAndTime. Let TimeZone be abstract and let FixedTimeZone implement the previous behavior with offset represented as a constant (no DST transition support). Other packages (e.g. TZ-Olson) may implement concrete TimeZone with DST support.
Add FixedTimeZoneTest updated from proposad by Christoph Thiede on squeak-dev (Review Request: allTimeZones.4.cs, Thu, 18 May 2023 22:11:32 +0200)
=============== Diff against Chronology-Tests-dtl.32 ===============
Item was changed: ----- Method: DateAndTimeEpochTest>>setUp (in category 'running') ----- setUp localTimeZoneToRestore := DateAndTime localTimeZone. localTimeZonePreferenceToRestore := DateAndTime automaticTimezone. aDateAndTime := DateAndTime localTimeZone: TimeZone default; epoch. + aTimeZone := FixedTimeZone offset: (Duration minutes: 135) name: 'Epoch Test Time Zone' abbreviation: 'ETZ'. - aTimeZone := TimeZone offset: (Duration minutes: 135) name: 'Epoch Test Time Zone' abbreviation: 'ETZ'. aDuration := Duration days: 1 hours: 2 minutes: 3 seconds: 4 nanoSeconds: 5 !
Item was changed: ----- Method: DateAndTimeEpochTest>>testPrintOn (in category 'tests') ----- testPrintOn | ref ws | ref := '1901-01-01T00:00:00+00:00'. ws := '' writeStream. aDateAndTime printOn: ws. self assert: ws contents = ref. + ref := 'a ConstantTimeZone(ETZ)'. - ref := 'a TimeZone(ETZ)'. ws := '' writeStream. aTimeZone printOn: ws. self assert: ws contents = ref!
Item was changed: ----- Method: DateAndTimeLeapTest>>testPrintOn (in category 'testing') ----- testPrintOn | ref ws | ref := '2004-02-29T13:33:00+02:00'. ws := '' writeStream. aDateAndTime printOn: ws. self assert: ws contents = ref. + ref := 'a ConstantTimeZone(UTC)'. - ref := 'a TimeZone(UTC)'. ws := '' writeStream. aTimeZone printOn: ws. self assert: ws contents = ref !
Item was changed: ----- Method: DateTest>>testMakeUTC (in category 'testing') ----- testMakeUTC "Equal dates should compare equal regardless of which TimeZone they are created in."
| priorTz priorPreference march31stLocal march31stOcean | priorTz := DateAndTime localTimeZone. priorPreference := DateAndTime automaticTimezone.
[DateAndTime + localTimeZone: (FixedTimeZone - 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 asLocalAt: DateAndTime localTimeZone offset).
DateAndTime + localTimeZone: (FixedTimeZone - 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 asLocalAt: DateAndTime localTimeZone offset).] ensure: [DateAndTime localTimeZone: priorTz. DateAndTime automaticTimezone: priorPreference].
self deny: march31stLocal = march31stOcean; assert: march31stOcean > march31stLocal.
self assert: march31stLocal makeUTC = march31stOcean makeUTC; deny: march31stOcean makeUTC > march31stLocal makeUTC; deny: march31stOcean makeUTC < march31stLocal makeUTC.!
Item was added: + ClassTestCase subclass: #FixedTimeZoneTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Chronology-Tests'!
Item was added: + ----- Method: FixedTimeZoneTest>>testAllForOffset (in category 'tests') ----- + testAllForOffset + + self assert: ((self classToBeTested allForOffset: 0 hours) collect: #abbreviation) = #('UTC' 'GMT'). + self assert: (self classToBeTested allForOffset: -14 hours) isEmpty.!
Item was added: + ----- Method: FixedTimeZoneTest>>testAllTimeZones (in category 'tests') ----- + testAllTimeZones + + self assert: self classToBeTested allTimeZones notEmpty. + self assert: (self classToBeTested allTimeZones anySatisfy: [:ea | ea offset = 2 hours]).!
Item was changed: ----- Method: ScheduleTest>>setUp (in category 'running') ----- setUp "Schedule is a type of Timespan representing repeated occurences of the same event. The beginning of the schedule is the first occurrence of the event. A schedule maintains an array of Durations. Each durations specify the offset to the next scheduled each. The duration of each occurence of the event is not specified. Nor are any other attributes such as name"
restoredTimeZone := DateAndTime localTimeZone. localTimeZonePreferenceToRestore := DateAndTime automaticTimezone. + DateAndTime localTimeZone: (FixedTimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']). - DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']).
"Create aSchedule with an event scheduled for 8:30pm every Saturday and Sunday for the year 2003. " "Create the first event occurring on the first Saturday at 8:30 pm: 1/4/03" firstEvent := DateAndTime year: 2003 month: 1 day: 4 hour: 20 minute: 30. "Create a schedule for one year starting with the first event" aSchedule := Schedule starting: firstEvent duration: 52 weeks.
"Schedule the recurring events by scheduling the time in between each one. One day for Sat-Sun. 6 days for Sun-Sat" aSchedule schedule: { Duration days: 1. Duration days: 6 }. !
Item was changed: ----- Method: YearMonthWeekTest>>setUp (in category 'running') ----- setUp restoredStartDay := Week startDay. restoredTimeZone := DateAndTime localTimeZone. localTimeZonePreferenceToRestore := DateAndTime automaticTimezone. Week startDay: #Sunday. + DateAndTime localTimeZone: (FixedTimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']). - DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']). !
packages@lists.squeakfoundation.org