[squeak-dev] The Trunk: KernelTests-nice.244.mcz

Eliot Miranda eliot.miranda at gmail.com
Sat Feb 23 23:35:00 UTC 2013


Please, please, *please* let's not do things like WriteStream on: ''.
Just decompile the method and you'll see why.  Please, please,
*PLEASE* use either WriteStream on: String new or WriteStream on: ''
copy.  Modifying literals is a baaaad idea.


On Sat, Feb 23, 2013 at 11:49 AM,  <commits at source.squeak.org> wrote:
> Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
> http://source.squeak.org/trunk/KernelTests-nice.244.mcz
>
> ==================== Summary ====================
>
> Name: KernelTests-nice.244
> Author: nice
> Time: 23 February 2013, 8:49:05.862 pm
> UUID: 7b3445ea-0910-4ee4-a6c7-c7305f930764
> Ancestors: KernelTests-fbs.243
>
> Avoid using ReadWriteStream gratuitously when we just need a WriteStream.
>
> =============== Diff against KernelTests-fbs.243 ===============
>
> Item was changed:
>   ----- Method: DateAndTimeEpochTest>>testPrintOn (in category 'testing') -----
>   testPrintOn
> +       | ref ws |
> +       ref := '1901-01-01T00:00:00+00:00'.
> +       ws := '' writeStream.
> +       aDateAndTime printOn: ws.
> +       self assert: ws contents = ref.
> +       ref  := 'a TimeZone(ETZ)'.
> +       ws := '' writeStream.
> +       aTimeZone printOn:  ws.
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: '1901-01-01T00:00:00+00:00'.
> -       rw := ReadWriteStream on: ''.
> -       aDateAndTime printOn: rw.
> -       self assert: rw contents = cs contents.
> -       cs  := ReadStream on: 'a TimeZone(ETZ)'.
> -       rw := ReadWriteStream on: ''.
> -       aTimeZone printOn:  rw.
> -       self assert: rw contents = cs contents!
>
> 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 TimeZone(UTC)'.
> +       ws := '' writeStream.
> +       aTimeZone printOn:  ws.
> +       self assert: ws contents = ref  !
> -       | cs rw |
> -       cs := ReadStream on: '2004-02-29T13:33:00+02:00'.
> -       rw := ReadWriteStream on: ''.
> -       aDateAndTime printOn: rw.
> -       self assert: rw contents = cs contents.
> -       cs  := ReadStream on: 'a TimeZone(UTC)'.
> -       rw := ReadWriteStream on: ''.
> -       aTimeZone printOn:  rw.
> -       self assert: rw contents = cs contents  !
>
> Item was changed:
>   ----- Method: DateTest>>testPrintOn (in category 'testing') -----
>   testPrintOn
> +       | ref ws |
> +       ref := '23 January 2004'.
> +       ws := '' writeStream.
> +       aDate printOn: ws.
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: '23 January 2004'.
> -       rw := ReadWriteStream on: ''.
> -       aDate printOn: rw.
> -       self assert: rw contents = cs contents!
>
> Item was changed:
>   ----- Method: DateTest>>testPrintOnFormat (in category 'testing') -----
>   testPrintOnFormat
> +       | ref ws |
> +       ref :='04*Jan*23'.
> +       ws := '' writeStream.
> +       aDate printOn: ws format: #(3 2 1 $* 2 2).
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: '04*Jan*23'.
> -       rw := ReadWriteStream on: ''.
> -       aDate printOn: rw format: #(3 2 1 $* 2 2).
> -       self assert: rw contents = cs contents!
>
> Item was changed:
>   ----- Method: DateTest>>testStoreOn (in category 'testing') -----
>   testStoreOn
> +       | ref ws |
> +       ref := '''23 January 2004'' asDate'.
> +       ws := '' writeStream.
> +       aDate storeOn: ws.
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: '''23 January 2004'' asDate'.
> -       rw := ReadWriteStream on: ''.
> -       aDate storeOn: rw.
> -       self assert: rw contents = cs contents!
>
> Item was changed:
>   ----- Method: DurationTest>>testPrintOn (in category 'testing') -----
>   testPrintOn
> +       | ref ws |
> +       ref := '1:02:03:04.000000005'.
> +       ws := '' writeStream.
> +       aDuration printOn: ws.
> +       self assert: ws contents = ref!
> -       |cs rw |
> -       cs := ReadStream on: '1:02:03:04.000000005'.
> -       rw := ReadWriteStream on: ''.
> -      aDuration printOn: rw.
> -      self assert: rw contents = cs contents.!
>
> Item was changed:
>   ----- Method: IntegerTest>>testPrintOnBaseShowRadix (in category 'tests - printing') -----
>   testPrintOnBaseShowRadix
>         | s |
> +       s := '' writeStream.
> -       s := ReadWriteStream on: ''.
>         123 printOn: s base: 10 showRadix: false.
>         self assert: (s contents = '123').
>
> +       s := '' writeStream.
> -       s := ReadWriteStream on: ''.
>         123 printOn: s base: 10 showRadix: true.
>         self assert: (s contents = '10r123').
>
> +       s := '' writeStream.
> -       s := ReadWriteStream on: ''.
>         123 printOn: s base: 8 showRadix: false.
>         self assert: (s contents = '173').
>
> +       s := '' writeStream.
> -       s := ReadWriteStream on: ''.
>         123 printOn: s base: 8 showRadix: true.
>         self assert: (s contents = '8r173').!
>
> Item was changed:
>   ----- Method: StopwatchTest>>testPrintOn (in category 'testing') -----
>   testPrintOn
> +       | ref ws |
> +       ref := 'a Stopwatch(suspended:0:00:00:00)'.
> +       ws := '' writeStream.
> +       aStopwatch printOn: ws.
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: 'a Stopwatch(suspended:0:00:00:00)'.
> -       rw := ReadWriteStream on: ''.
> -       aStopwatch printOn: rw.
> -       self assert: rw contents = cs contents!
>
> Item was changed:
>   ----- Method: TimeStampTest>>testPrintOn (in category 'testing') -----
>   testPrintOn
> +       | ref ws |
> +       ref := '2 January 2004 12:34:56 am'.
> +       ws := '' writeStream.
> +       aTimeStamp printOn: ws.
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: '2 January 2004 12:34:56 am'.
> -       rw := ReadWriteStream on: ''.
> -       aTimeStamp printOn: rw.
> -       self assert: rw contents = cs contents!
>
> Item was changed:
>   ----- Method: TimeStampTest>>testStoreOn (in category 'testing') -----
>   testStoreOn
> +       | ref ws |
> +       ref := '''2 January 2004 12:34:56 am'' asTimeStamp'.
> +       ws := '' writeStream.
> +       aTimeStamp storeOn: ws.
> +       self assert: ws contents = ref!
> -       | cs rw |
> -       cs := ReadStream on: '''2 January 2004 12:34:56 am'' asTimeStamp'.
> -       rw := ReadWriteStream on: ''.
> -       aTimeStamp storeOn: rw.
> -       self assert: rw contents = cs contents!
>
> Item was changed:
>   ----- Method: TimespanTest>>testPrintOn (in category 'testing') -----
>   testPrintOn
> +       | ref ws |
> +       ref := 'a Timespan(2005-01-01T00:00:00+00:00D7:00:00:00)'.
> +       ws := '' writeStream.
> +       aTimespan printOn: ws.
> +       self assert: ws contents = ref
> -       | cs rw |
> -       cs := ReadStream on: 'a Timespan(2005-01-01T00:00:00+00:00D7:00:00:00)'.
> -       rw := ReadWriteStream on: ''.
> -       aTimespan  printOn: rw.
> -       self assert: rw contents = cs contents
>   !
>
> Item was changed:
>   ----- Method: YearMonthWeekTest>>testMonthPrintOn (in category 'testing') -----
>   testMonthPrintOn
> +       | aMonth ws |
> +       aMonth := Month starting: DateAndTime new duration: 31 days.
> +       ws := '' writeStream.
> +       aMonth printOn: ws.
> +       self assert: ws contents = 'January 1901'.!
> -       | aMonth cs rw |
> -       aMonth := Month starting: DateAndTime new duration: 31 days.
> -       cs := ReadStream on: 'January 1901'.
> -       rw := ReadWriteStream on: ''.
> -      aMonth printOn: rw.
> -      self assert: rw contents = cs contents.!
>
> Item was changed:
>   ----- Method: YearMonthWeekTest>>testYearPrintOn (in category 'testing') -----
>   testYearPrintOn
> +       | aYear ws |
> +       aYear := Year starting: DateAndTime new duration: 365 days.
> +       ws := '' writeStream.
> +       aYear printOn: ws.
> +       self assert: ws contents = 'a Year (1901)'.!
> -       | aYear cs rw |
> -       aYear := Year starting: DateAndTime new duration: 365 days.
> -       cs := ReadStream on: 'a Year (1901)'.
> -       rw := ReadWriteStream on: ''.
> -      aYear printOn: rw.
> -      self assert: rw contents = cs contents.!
>
>



-- 
best,
Eliot


More information about the Squeak-dev mailing list