The Trunk: MultilingualTests-fn.35.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MultilingualTests-fn.35.mcz

commits-2
Fabio Niephaus uploaded a new version of MultilingualTests to project The Trunk:
http://source.squeak.org/trunk/MultilingualTests-fn.35.mcz

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

Name: MultilingualTests-fn.35
Author: fn
Time: 13 October 2018, 4:33:22.250858 pm
UUID: babc3062-0aa8-4592-9fc1-50db1ec2cc30
Ancestors: MultilingualTests-pre.34

Excludes TextConverters that do not support line end conversion yet in #testLineEndConversion, revert to older version of MultiByteFileStreamTest>>testLineEndConvention:withConverter:ifFail:, and add #testLineEndConversionExpectedFailures.

=============== Diff against MultilingualTests-pre.34 ===============

Item was added:
+ ----- Method: MultiByteFileStreamTest>>expectedFailures (in category 'testing') -----
+ expectedFailures
+ ^ #(testLineEndConversionExpectedFailures)!

Item was changed:
  ----- Method: MultiByteFileStreamTest>>testLineEndConvention:withConverter:ifFail: (in category 'helpers') -----
  testLineEndConvention: lineEndConvention withConverter: textConverterClass ifFail: failBlock
 
  | expectedResult result |
  [
  MultiByteFileStream forceNewFileNamed: fileName do: [ :file |
  file
  converter: textConverterClass new;
  lineEndConvention: lineEndConvention;
  cr;
  nextPut: Character cr;
  nextPutAll: String cr;
  nextPutAll: String cr asWideString ].
+ result := StandardFileStream oldFileNamed: fileName do: [ :file |
+ file contents ].
- result := MultiByteFileStream oldFileNamed: fileName do: [ :file |
- file
- converter: textConverterClass new;
- contents ].
  expectedResult := String streamContents: [ :stream |
  4 timesRepeat: [ stream perform: lineEndConvention ] ].
  result = expectedResult ifFalse: [
  failBlock value: expectedResult asByteArray value: result asByteArray ] ]
  on: Error
  do: [ :err | failBlock value: err messageText value: err messageText ]!

Item was changed:
  ----- Method: MultiByteFileStreamTest>>testLineEndConversion (in category 'testing') -----
  testLineEndConversion
 
  | failures |
  fileName := 'foolinendconversion.txt'.
  failures := OrderedCollection new.
+ self textConvertersWithLineEndConversionSupport do: [ :textConverterClass |
- TextConverter allSubclassesDo: [ :textConverterClass |
  textConverterClass encodingNames ifNotEmpty: [
  #(cr lf crlf) do: [ :lineEndConvention |
  self
  testLineEndConvention: lineEndConvention
  withConverter: textConverterClass
  ifFail: [ :expectedResult :result |
  failures add: {
  textConverterClass.
  lineEndConvention.
  expectedResult.
  result } ] ] ] ].
  self assert: failures isEmpty.
  "The code below is here to help you see why those cases fail"
  failures do: [ :failure |
  self
  testLineEndConvention: failure second
  withConverter: failure first
  ifFail: [ :expectedResult :result | self halt ] ].!

Item was added:
+ ----- Method: MultiByteFileStreamTest>>testLineEndConversionExpectedFailures (in category 'testing') -----
+ testLineEndConversionExpectedFailures
+ "Copy of #testLineEndConversion checking for missing line conversion implementations.
+ This test and corresponding helpers (see senders) can be removed as soon as all TextConverters support line end conversion. --fn"
+ | failures |
+ fileName := 'foolinendconversion_failures.txt'.
+ failures := OrderedCollection new.
+ self textConvertersWithoutLineEndConversionSupport do: [ :textConverterClass |
+ textConverterClass encodingNames ifNotEmpty: [
+ #(cr lf crlf) do: [ :lineEndConvention |
+ self
+ testLineEndConvention: lineEndConvention
+ withConverter: textConverterClass
+ ifFail: [ :expectedResult :result |
+ failures add: {
+ textConverterClass.
+ lineEndConvention.
+ expectedResult.
+ result } ] ] ] ].
+ self assert: failures isEmpty.
+ "The code below is here to help you see why those cases fail"
+ failures do: [ :failure |
+ self
+ testLineEndConvention: failure second
+ withConverter: failure first
+ ifFail: [ :expectedResult :result | self halt ] ].!

Item was added:
+ ----- Method: MultiByteFileStreamTest>>textConvertersWithLineEndConversionSupport (in category 'helpers') -----
+ textConvertersWithLineEndConversionSupport
+ self flag: #testLineEndConversionExpectedFailures.
+ ^ TextConverter allSubclasses difference: self textConvertersWithoutLineEndConversionSupport!

Item was added:
+ ----- Method: MultiByteFileStreamTest>>textConvertersWithoutLineEndConversionSupport (in category 'helpers') -----
+ textConvertersWithoutLineEndConversionSupport
+ self flag: #testLineEndConversionExpectedFailures.
+ ^ EUCTextConverter allSubclasses union: {ShiftJISTextConverter. CompoundTextConverter. KOI8RTextConverter}!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MultilingualTests-fn.35.mcz

Levente Uzonyi
On Sat, 13 Oct 2018, [hidden email] wrote:

> Fabio Niephaus uploaded a new version of MultilingualTests to project The Trunk:
> http://source.squeak.org/trunk/MultilingualTests-fn.35.mcz
>
> ==================== Summary ====================
>
> Name: MultilingualTests-fn.35
> Author: fn
> Time: 13 October 2018, 4:33:22.250858 pm
> UUID: babc3062-0aa8-4592-9fc1-50db1ec2cc30
> Ancestors: MultilingualTests-pre.34
>
> Excludes TextConverters that do not support line end conversion yet in #testLineEndConversion, revert to older version of MultiByteFileStreamTest>>testLineEndConvention:withConverter:ifFail:, and add #testLineEndConversionExpectedFailures.
>
> =============== Diff against MultilingualTests-pre.34 ===============
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>expectedFailures (in category 'testing') -----
> + expectedFailures
> + ^ #(testLineEndConversionExpectedFailures)!
>
> Item was changed:
>  ----- Method: MultiByteFileStreamTest>>testLineEndConvention:withConverter:ifFail: (in category 'helpers') -----
>  testLineEndConvention: lineEndConvention withConverter: textConverterClass ifFail: failBlock
>
>   | expectedResult result |
>   [
>   MultiByteFileStream forceNewFileNamed: fileName do: [ :file |
>   file
>   converter: textConverterClass new;
>   lineEndConvention: lineEndConvention;
>   cr;
>   nextPut: Character cr;
>   nextPutAll: String cr;
>   nextPutAll: String cr asWideString ].
> + result := StandardFileStream oldFileNamed: fileName do: [ :file |
> + file contents ].
> - result := MultiByteFileStream oldFileNamed: fileName do: [ :file |
> - file
> - converter: textConverterClass new;
> - contents ].

Um. The goal of this test is to test MultiByteFileStream's line end
conversion capability. Changing MultiByteFileStream to StandardFileStream
will render the test meaningless...

Levente

>   expectedResult := String streamContents: [ :stream |
>   4 timesRepeat: [ stream perform: lineEndConvention ] ].
>   result = expectedResult ifFalse: [
>   failBlock value: expectedResult asByteArray value: result asByteArray ] ]
>   on: Error
>   do: [ :err | failBlock value: err messageText value: err messageText ]!
>
> Item was changed:
>  ----- Method: MultiByteFileStreamTest>>testLineEndConversion (in category 'testing') -----
>  testLineEndConversion
>
>   | failures |
>   fileName := 'foolinendconversion.txt'.
>   failures := OrderedCollection new.
> + self textConvertersWithLineEndConversionSupport do: [ :textConverterClass |
> - TextConverter allSubclassesDo: [ :textConverterClass |
>   textConverterClass encodingNames ifNotEmpty: [
>   #(cr lf crlf) do: [ :lineEndConvention |
>   self
>   testLineEndConvention: lineEndConvention
>   withConverter: textConverterClass
>   ifFail: [ :expectedResult :result |
>   failures add: {
>   textConverterClass.
>   lineEndConvention.
>   expectedResult.
>   result } ] ] ] ].
>   self assert: failures isEmpty.
>   "The code below is here to help you see why those cases fail"
>   failures do: [ :failure |
>   self
>   testLineEndConvention: failure second
>   withConverter: failure first
>   ifFail: [ :expectedResult :result | self halt ] ].!
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>testLineEndConversionExpectedFailures (in category 'testing') -----
> + testLineEndConversionExpectedFailures
> + "Copy of #testLineEndConversion checking for missing line conversion implementations.
> + This test and corresponding helpers (see senders) can be removed as soon as all TextConverters support line end conversion. --fn"
> + | failures |
> + fileName := 'foolinendconversion_failures.txt'.
> + failures := OrderedCollection new.
> + self textConvertersWithoutLineEndConversionSupport do: [ :textConverterClass |
> + textConverterClass encodingNames ifNotEmpty: [
> + #(cr lf crlf) do: [ :lineEndConvention |
> + self
> + testLineEndConvention: lineEndConvention
> + withConverter: textConverterClass
> + ifFail: [ :expectedResult :result |
> + failures add: {
> + textConverterClass.
> + lineEndConvention.
> + expectedResult.
> + result } ] ] ] ].
> + self assert: failures isEmpty.
> + "The code below is here to help you see why those cases fail"
> + failures do: [ :failure |
> + self
> + testLineEndConvention: failure second
> + withConverter: failure first
> + ifFail: [ :expectedResult :result | self halt ] ].!
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>textConvertersWithLineEndConversionSupport (in category 'helpers') -----
> + textConvertersWithLineEndConversionSupport
> + self flag: #testLineEndConversionExpectedFailures.
> + ^ TextConverter allSubclasses difference: self textConvertersWithoutLineEndConversionSupport!
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>textConvertersWithoutLineEndConversionSupport (in category 'helpers') -----
> + textConvertersWithoutLineEndConversionSupport
> + self flag: #testLineEndConversionExpectedFailures.
> + ^ EUCTextConverter allSubclasses union: {ShiftJISTextConverter. CompoundTextConverter. KOI8RTextConverter}!

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: MultilingualTests-fn.35.mcz

Patrick R.
Thanks for pointing that out! After debugging it some more I now remember the cause for this failure again (The line ending conversion installation assumes 1 byte text converters. Multi-byte text converters have to convert the line ending before installing it).

I will revert that part of the test (again :)) in both repositories.

(The 2011 version of that method was before the MultiByteFileStream change?)
________________________________________
From: Squeak-dev <[hidden email]> on behalf of Levente Uzonyi <[hidden email]>
Sent: Saturday, October 13, 2018 16:51
To: [hidden email]
Cc: [hidden email]
Subject: Re: [squeak-dev] The Trunk: MultilingualTests-fn.35.mcz

On Sat, 13 Oct 2018, [hidden email] wrote:

> Fabio Niephaus uploaded a new version of MultilingualTests to project The Trunk:
> http://source.squeak.org/trunk/MultilingualTests-fn.35.mcz
>
> ==================== Summary ====================
>
> Name: MultilingualTests-fn.35
> Author: fn
> Time: 13 October 2018, 4:33:22.250858 pm
> UUID: babc3062-0aa8-4592-9fc1-50db1ec2cc30
> Ancestors: MultilingualTests-pre.34
>
> Excludes TextConverters that do not support line end conversion yet in #testLineEndConversion, revert to older version of MultiByteFileStreamTest>>testLineEndConvention:withConverter:ifFail:, and add #testLineEndConversionExpectedFailures.
>
> =============== Diff against MultilingualTests-pre.34 ===============
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>expectedFailures (in category 'testing') -----
> + expectedFailures
> +     ^ #(testLineEndConversionExpectedFailures)!
>
> Item was changed:
>  ----- Method: MultiByteFileStreamTest>>testLineEndConvention:withConverter:ifFail: (in category 'helpers') -----
>  testLineEndConvention: lineEndConvention withConverter: textConverterClass ifFail: failBlock
>
>       | expectedResult result |
>       [
>               MultiByteFileStream forceNewFileNamed: fileName do: [ :file |
>                       file
>                               converter: textConverterClass new;
>                               lineEndConvention: lineEndConvention;
>                               cr;
>                               nextPut: Character cr;
>                               nextPutAll: String cr;
>                               nextPutAll: String cr asWideString ].
> +             result := StandardFileStream oldFileNamed: fileName do: [ :file |
> +                     file contents ].
> -             result := MultiByteFileStream oldFileNamed: fileName do: [ :file |
> -                     file
> -                             converter: textConverterClass new;
> -                             contents ].

Um. The goal of this test is to test MultiByteFileStream's line end
conversion capability. Changing MultiByteFileStream to StandardFileStream
will render the test meaningless...

Levente

>               expectedResult := String streamContents: [ :stream |
>                       4 timesRepeat: [ stream perform: lineEndConvention ] ].
>               result = expectedResult ifFalse: [
>                       failBlock value: expectedResult asByteArray value: result asByteArray ] ]
>               on: Error
>               do: [ :err | failBlock value: err messageText value: err messageText ]!
>
> Item was changed:
>  ----- Method: MultiByteFileStreamTest>>testLineEndConversion (in category 'testing') -----
>  testLineEndConversion
>
>       | failures |
>       fileName := 'foolinendconversion.txt'.
>       failures := OrderedCollection new.
> +     self textConvertersWithLineEndConversionSupport do: [ :textConverterClass |
> -     TextConverter allSubclassesDo: [ :textConverterClass |
>               textConverterClass encodingNames ifNotEmpty: [
>                       #(cr lf crlf) do: [ :lineEndConvention |
>                               self
>                                       testLineEndConvention: lineEndConvention
>                                       withConverter: textConverterClass
>                                       ifFail: [ :expectedResult :result |
>                                               failures add: {
>                                                       textConverterClass.
>                                                       lineEndConvention.
>                                                       expectedResult.
>                                                       result } ] ] ] ].
>       self assert: failures isEmpty.
>       "The code below is here to help you see why those cases fail"
>       failures do: [ :failure |
>               self
>                       testLineEndConvention: failure second
>                       withConverter: failure first
>                       ifFail: [ :expectedResult :result | self halt ] ].!
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>testLineEndConversionExpectedFailures (in category 'testing') -----
> + testLineEndConversionExpectedFailures
> +     "Copy of #testLineEndConversion checking for missing line conversion implementations.
> +      This test and corresponding helpers (see senders) can be removed as soon as all TextConverters support line end conversion. --fn"
> +     | failures |
> +     fileName := 'foolinendconversion_failures.txt'.
> +     failures := OrderedCollection new.
> +     self textConvertersWithoutLineEndConversionSupport do: [ :textConverterClass |
> +             textConverterClass encodingNames ifNotEmpty: [
> +                     #(cr lf crlf) do: [ :lineEndConvention |
> +                             self
> +                                     testLineEndConvention: lineEndConvention
> +                                     withConverter: textConverterClass
> +                                     ifFail: [ :expectedResult :result |
> +                                             failures add: {
> +                                                     textConverterClass.
> +                                                     lineEndConvention.
> +                                                     expectedResult.
> +                                                     result } ] ] ] ].
> +     self assert: failures isEmpty.
> +     "The code below is here to help you see why those cases fail"
> +     failures do: [ :failure |
> +             self
> +                     testLineEndConvention: failure second
> +                     withConverter: failure first
> +                     ifFail: [ :expectedResult :result | self halt ] ].!
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>textConvertersWithLineEndConversionSupport (in category 'helpers') -----
> + textConvertersWithLineEndConversionSupport
> +     self flag: #testLineEndConversionExpectedFailures.
> +     ^ TextConverter allSubclasses difference: self textConvertersWithoutLineEndConversionSupport!
>
> Item was added:
> + ----- Method: MultiByteFileStreamTest>>textConvertersWithoutLineEndConversionSupport (in category 'helpers') -----
> + textConvertersWithoutLineEndConversionSupport
> +     self flag: #testLineEndConversionExpectedFailures.
> +     ^ EUCTextConverter allSubclasses union: {ShiftJISTextConverter. CompoundTextConverter. KOI8RTextConverter}!