[squeak-dev] The Trunk: Chronology-Tests-dtl.7.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 4 17:27:38 UTC 2016


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

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

Name: Chronology-Tests-dtl.7
Author: dtl
Time: 4 December 2016, 12:27:31.985405 pm
UUID: c395f2d9-7c78-4a8a-a682-ba738829f8da
Ancestors: Chronology-Tests-dtl.6

Tests that send DateAndTime class>>localTimeZone: will set the automaticTimeZone preference as an unintended side effect. Save and restore the preference when running these tests.

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

Item was changed:
  TestCase subclass: #DateAndTimeEpochTest
+ 	instanceVariableNames: 'aDateAndTime aDuration aTimeZone localTimeZoneToRestore localTimeZonePreferenceToRestore'
- 	instanceVariableNames: 'aDateAndTime aDuration aTimeZone localTimeZoneToRestore'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Chronology-Tests'!
  
  !DateAndTimeEpochTest commentStamp: 'tlk 1/6/2004 18:27' prior: 0!
  I represent one of several Sunit test Cases intentended to provide complete coverage  for the Chronology set of classes as part of the external testing. The other Chronology sunit test cases are:
   DateTestCase
   DateAndTimeLeapTestCase,
   DurationTestCase,
   ScheduleTestCase
   TimeStampTestCase
   TimespanDoTestCase, 
   TimespanDoSpanAYearTestCase, 
   TimespanTestCase, 
   YearMonthWeekTestCase.  
  These tests attempt to exercise all public and private methods.  Except, they do not explicitly depreciated methods. tlk
  My fixtures are:
  aDateAndTime = January 01, 1901 midnight (the start of the Squeak epoch) with localTimeZone = Grenwhich Meridian (local offset = 0 hours)
  aDuration = 1 day, 2 hours, 3, minutes, 4 seconds and 5 nano seconds.
  aTimeZone =  'Epoch Test Time Zone', 'ETZ' , offset: 12 hours, 15 minutes. !

Item was changed:
  ----- Method: DateAndTimeEpochTest>>setUp (in category 'running') -----
  setUp
+ 	localTimeZoneToRestore := DateAndTime localTimeZone.
+ 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
-      localTimeZoneToRestore := DateAndTime localTimeZone.
  	aDateAndTime :=  DateAndTime localTimeZone: TimeZone default; epoch.
  	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>>tearDown (in category 'running') -----
  tearDown
+ 	DateAndTime localTimeZone: localTimeZoneToRestore.
+ 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
-      DateAndTime localTimeZone: localTimeZoneToRestore.
       "wish I could remove the time zones I added earlier, tut there is no method for that"
  !

Item was changed:
  TestCase subclass: #DateAndTimeLeapTest
+ 	instanceVariableNames: 'aDateAndTime aDuration aTimeZone localTimeZoneToRestore localTimeZonePreferenceToRestore'
- 	instanceVariableNames: 'aDateAndTime aDuration aTimeZone localTimeZoneToRestore'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Chronology-Tests'!
  
  !DateAndTimeLeapTest commentStamp: 'tlk 1/6/2004 17:54' prior: 0!
  I represent one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. tlk.
  My fixtures are:
  aDateAndTime = February 29, 2004 1:33 PM with offset: 2 hours
  aDuration = 15 days, 14 hours, 13 minutes, 12 seconds and 11 nano seconds.
  aTimeZone =  Grenwhich Meridian (local offset = 0 hours) !

Item was changed:
  ----- Method: DateAndTimeLeapTest>>setUp (in category 'running') -----
  setUp
  	localTimeZoneToRestore := DateAndTime localTimeZone.
+ 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
  	DateAndTime localTimeZone: TimeZone default.
  	aDateAndTime := (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours).
  	aTimeZone := TimeZone default.
  	aDuration := Duration days: 0 hours: 13 minutes: 33 seconds: 0 nanoSeconds: 0
  !

Item was changed:
  ----- Method: DateAndTimeLeapTest>>tearDown (in category 'running') -----
  tearDown
       DateAndTime localTimeZone: localTimeZoneToRestore.
+ 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
       "wish I could remove the time zones I added earlier, tut there is no method for that"
  !

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 march31stLocal march31stOcean | 
  	priorTz := DateAndTime localTimeZone.
+ 	priorPreference := DateAndTime automaticTimezone.
  
  	[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).
   
  	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.
+ 				DateAndTime automaticTimezone: priorPreference].
- 		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.!

Item was changed:
  ClassTestCase subclass: #ScheduleTest
+ 	instanceVariableNames: 'firstEvent aSchedule restoredTimeZone localTimeZonePreferenceToRestore'
- 	instanceVariableNames: 'firstEvent aSchedule restoredTimeZone'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Chronology-Tests'!

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: (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: ScheduleTest>>tearDown (in category 'running') -----
  tearDown
  
  	DateAndTime localTimeZone: restoredTimeZone.
+ 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
+  !
- !

Item was changed:
  ClassTestCase subclass: #TimeTest
+ 	instanceVariableNames: 'time aTime localTimeZoneToRestore timeWithNanos localTimeZonePreferenceToRestore'
- 	instanceVariableNames: 'time aTime localTimeZoneToRestore timeWithNanos'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Chronology-Tests'!
  
  !TimeTest commentStamp: '<historical>' prior: 0!
  This is the unit test for the class Time.
  
  !

Item was changed:
  ----- Method: TimeTest>>setUp (in category 'Running') -----
  setUp
  
  	localTimeZoneToRestore := DateAndTime localTimeZone.
+ 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
  	DateAndTime localTimeZone: TimeZone default.
  	time := self timeClass fromSeconds: 14567.		"4:02:47 am"
  	aTime := self timeClass readFrom: '12:34:56 pm' readStream.
  	timeWithNanos := self timeClass fromSeconds: 14567.42.
  !

Item was changed:
  ----- Method: TimeTest>>tearDown (in category 'Running') -----
  tearDown
  	DateAndTime localTimeZone: localTimeZoneToRestore.
+ 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
+  !
- !

Item was changed:
  ClassTestCase subclass: #TimespanTest
+ 	instanceVariableNames: 'timespan aTimespan anOverlappingTimespan anIncludedTimespan aDisjointTimespan aDay aWeek dec31 jan01 jan08 localTimeZoneToRestore anEqualTimeSpan localTimeZonePreferenceToRestore'
- 	instanceVariableNames: 'timespan aTimespan anOverlappingTimespan anIncludedTimespan aDisjointTimespan aDay aWeek dec31 jan01 jan08 localTimeZoneToRestore anEqualTimeSpan'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Chronology-Tests'!

Item was changed:
  ----- Method: TimespanTest>>setUp (in category 'Running') -----
  setUp
  
  	| jan01HereSomeWhereElseOnEarth |
  	localTimeZoneToRestore := DateAndTime localTimeZone.
+ 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
  	DateAndTime localTimeZone: TimeZone default.
  
  	"100 hours starting noon 22 March 2003"
  	timespan := Timespan starting:
  					(DateAndTime year: 2003 month: 03 day: 22 hour: 12 minute: 0 second: 0)
  						duration: (Duration hours: 100).
  
  	dec31 := (DateAndTime year: 2004 month: 12 day: 31 hour: 0 minute: 0 second: 0).
  	jan01 := (DateAndTime year: 2005 month: 1 day: 1 hour: 0 minute: 0 second: 0).
  	jan08 := (DateAndTime year: 2005 month: 1 day: 8 hour: 0 minute: 0 second:0).
  	aDay := Duration days: 1 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0.
  	aWeek := Duration days: 7 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0.
  	aTimespan := Timespan starting: jan01 duration: aWeek.
  	jan01HereSomeWhereElseOnEarth := DateAndTime new ticks: (jan01 + 3 hours) ticks offset: jan01 offset + 3 hours.
  	anEqualTimeSpan := Timespan starting: jan01HereSomeWhereElseOnEarth asUTC duration: aWeek.
  	anOverlappingTimespan := Timespan starting: dec31 duration: aWeek.
  	anIncludedTimespan := Timespan starting: jan01 duration: aDay.
  	aDisjointTimespan := Timespan starting: jan08 duration: aWeek.
  
  
  
  !

Item was changed:
  ----- Method: TimespanTest>>tearDown (in category 'Running') -----
  tearDown
  	DateAndTime localTimeZone: localTimeZoneToRestore.
+ 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
+  	timespan := nil
- 	timespan := nil
  !

Item was changed:
  TestCase subclass: #YearMonthWeekTest
+ 	instanceVariableNames: 'restoredStartDay restoredTimeZone localTimeZonePreferenceToRestore'
- 	instanceVariableNames: 'restoredStartDay restoredTimeZone'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Chronology-Tests'!
  
  !YearMonthWeekTest commentStamp: 'tlk 1/6/2004 17:55' prior: 0!
  I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndEpochTestCase for a complete list.  tlk.
  I have no fixtures but do make sure to restore anything I change.!

Item was changed:
  ----- Method: YearMonthWeekTest>>setUp (in category 'running') -----
  setUp
  	restoredStartDay := Week startDay.
  	restoredTimeZone := DateAndTime localTimeZone.
  
  	Week startDay: #Sunday.
+ 	DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']).
+ 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.!
- 	DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']).!

Item was changed:
  ----- Method: YearMonthWeekTest>>tearDown (in category 'running') -----
  tearDown
  	Week startDay: restoredStartDay.
+ 	DateAndTime localTimeZone: restoredTimeZone.
+ 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.!
- 	DateAndTime localTimeZone: restoredTimeZone.!



More information about the Squeak-dev mailing list