Andreas Raab uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ar.85.mcz==================== Summary ====================
Name: KernelTests-ar.85
Author: ar
Time: 25 August 2009, 8:22:23 am
UUID: 4e893949-199f-dc4d-9585-0814f2d57630
Ancestors: KernelTests-mha.84, KernelTests-it.69
Merged KernelTests-it.69:
Reformatted code in Week>>startDay.
Added tests for Week class methods indexOfDay:, nameOfDay: and dayNames.
=============== Diff against KernelTests-mha.84 ===============
Item was added:
+ ----- Method: WeekTest>>testIndexOfDay (in category 'Tests') -----
+ testIndexOfDay
+ | days |
+ days := #(#Sunday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday).
+
+ days withIndexDo: [:item :index | self assert: (Week indexOfDay: item) = index].
+
+ "This should probably raise an error rather than returning 0."
+ self assert: (Week indexOfDay: 0) = 0.
+ self assert: (Week indexOfDay: 1) = 0.
+ self assert: (Week indexOfDay: 7) = 0.
+ self assert: (Week indexOfDay: 8) = 0.
+ self assert: (Week indexOfDay: #Sunnyday) = 0.!
Item was added:
+ ----- Method: MonthTest>>testNameOfMonth (in category 'Tests') -----
+ testNameOfMonth
+
+ | m |
+ m := #(#January #February #March #April #May #June #July #August #September #October #November #December).
+
+ m withIndexDo: [:item :index | self assert: (Month nameOfMonth: index) = item].
+
+ self should: [Month nameOfMonth: 0] raise: TestResult error.
+ self should: [Month nameOfMonth: 13] raise: TestResult error.
+ self should: [Month nameOfMonth: #January] raise: TestResult error.!
Item was added:
+ ----- Method: WeekTest>>testNameOfDay (in category 'Tests') -----
+ testNameOfDay
+ | days |
+ days := #(#Sunday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday).
+
+ days withIndexDo: [:item :index | self assert: (Week nameOfDay: index) = item].
+
+ self should: [Week nameOfDay: 0] raise: TestResult error.
+ self should: [Week nameOfDay: 8] raise: TestResult error.
+ self should: [Week nameOfDay: #Sunday] raise: TestResult error.!
Item was added:
+ ----- Method: MonthTest>>testIndexOfMonth (in category 'Tests') -----
+ testIndexOfMonth
+
+ | m |
+ m := #(#January #February #March #April #May #June #July #August #September #October #November #December).
+
+ m withIndexDo: [:item :index | self assert: (Month indexOfMonth: item) = index].
+
+ self should: [Month indexOfMonth: 1] raise: TestResult error.
+ self should: [Month indexOfMonth: #1] raise: TestResult error.
+ self should: [Month indexOfMonth: #Marsh] raise: TestResult error. "notice the misspell!!"
+ self should: [Month indexOfMonth: #UnexistingMonth] raise: TestResult error.!
Item was added:
+ ----- Method: WeekTest>>testDayNames (in category 'Tests') -----
+ testDayNames
+ self assert: (Week dayNames) = #(#Sunday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday).!