A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-spd.157.mcz ==================== Summary ==================== Name: KernelTests-spd.157 Author: spd Time: 5 August 2010, 9:49:04.497 am UUID: 64fb209e-012d-4ff2-8d52-487f2a146e6c Ancestors: KernelTests-nice.156 - moved printString tests from testReadFrom to testPrintString - testReadFrom now tests [drum roll]... readFrom! - added testFromString All tests reflect new behavior from Kernel-spd.476 which fixed issue 7553 =============== Diff against KernelTests-nice.156 =============== Item was changed: ----- Method: DateAndTimeTest>>testReadFrom (in category 'Tests') ----- testReadFrom + self assert: ((DateAndTime readFrom: '-1199-01-05T20:33:14.321-05:00' readStream) printString = '-1199-01-05T20:33:14.321-05:00'). + + + ! - self assert: ('-1199-01-05T20:33:14.321-05:00' asDateAndTime printString = '-1199-01-05T20:33:14.321-05:00'). - self assert: ('2002-05-16T17:20:45.1+01:01' asDateAndTime printString = '2002-05-16T17:20:45.1+01:01'). - self assert: (' 2002-05-16T17:20:45.02+01:01' asDateAndTime printString = '2002-05-16T17:20:45.02+01:01'). - self assert: ('2002-05-16T17:20:45.000000009+01:01' asDateAndTime printString = '2002-05-16T17:20:45.000000009+01:01'). - self assert: (' 2002-05-16T17:20' asDateAndTime printString = '2002-05-16T17:20:00+00:00'). - self assert: ('2002-05-16T17:20:45' asDateAndTime printString = '2002-05-16T17:20:45+00:00' ). - self assert: (' 2002-05-16T17:20:45+01:57' asDateAndTime printString = '2002-05-16T17:20:45+01:57'). - self assert: (' 2002-05-16T17:20:45-02:34' asDateAndTime = '2002-05-16T17:20:45-02:34' asDateAndTime). - self assert: ('2002-05-16T17:20:45+00:00' asDateAndTime = '2002-05-16T17:20:45+00:00' asDateAndTime). - self assert: ('1997-04-26T01:02:03+01:02:3' asDateAndTime = '1997-04-26T01:02:03+01:02:3' asDateAndTime)! Item was changed: ----- Method: DateAndTimeTest>>testPrintString (in category 'Tests') ----- testPrintString "(self new setTestSelector: #testPrintString) debug" + | dt dtNoOffset | - | dt | dt :=DateAndTime year: 2004 month: 11 day: 2 hour: 14 minute: 3 second: 5 nanoSecond: 12345 offset: (Duration seconds: (5 * 3600)). + self assert: dt printString = '2004-11-02T14:03:05.000012345+05:00'. + + self assert: ('2002-05-16T17:20:45.1+01:01' asDateAndTime printString = '2002-05-16T17:20:45.1+01:01'). + self assert: (' 2002-05-16T17:20:45.02+01:01' asDateAndTime printString = '2002-05-16T17:20:45.02+01:01'). + self assert: ('2002-05-16T17:20:45.000000009+01:01' asDateAndTime printString = '2002-05-16T17:20:45.000000009+01:01'). + self assert: ('2002-05-16T17:20:45+00:00' asDateAndTime printString = '2002-05-16T17:20:45+00:00' ). + self assert: (' 2002-05-16T17:20:45+01:57' asDateAndTime printString = '2002-05-16T17:20:45+01:57'). + self assert: (' 2002-05-16T17:20:45-02:34' asDateAndTime = '2002-05-16T17:20:45-02:34'). + self assert: ('2002-05-16T17:20:45+00:00' asDateAndTime = '2002-05-16T17:20:45+00:00'). + self assert: ('1997-04-26T01:02:03+01:02:3' asDateAndTime = '1997-04-26T01:02:03+01:02:3'). - self assert: dt printString = '2004-11-02T14:03:05.000012345+05:00' + "When no offset is provided, the local one is used" + dtNoOffset := '2002-05-16T17:20' asDateAndTime. + self assert: (('2002-05-16T17:20:00*' match: dtNoOffset printString) and: [dtNoOffset offset = DateAndTime localOffset]). ! Item was added: + ----- Method: DateAndTimeTest>>testFromString (in category 'Tests') ----- + testFromString + + | fromString fromStringNoOffset | + fromString := DateAndTime fromString: '-1199-01-05T20:33:14.321-05:00'. + self assert: (fromString printString = '-1199-01-05T20:33:14.321-05:00'). + + "if no offset is provided, the local offset should be used" + fromStringNoOffset := DateAndTime fromString: '-1199-01-05T20:33:14.321'. + self assert: (fromStringNoOffset offset = DateAndTime localOffset).! |
Free forum by Nabble | Edit this page |