[squeak-dev] The Trunk: MultilingualTests-fn.35.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Oct 13 14:33:37 UTC 2018
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}!
More information about the Squeak-dev
mailing list
|