The Trunk: CollectionsTests-nice.111.mcz

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

The Trunk: CollectionsTests-nice.111.mcz

commits-2
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.111.mcz

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

Name: CollectionsTests-nice.111
Author: nice
Time: 16 November 2009, 1:24:55 am
UUID: 90a161dc-726d-5b4a-9f72-a50695b4899a
Ancestors: CollectionsTests-ar.110

Some tests for cr/lf/crlf line delimiters

=============== Diff against CollectionsTests-ar.110 ===============

Item was added:
+ ----- Method: StringTest>>testLineNumber (in category 'testing - lines') -----
+ testLineNumber
+ | sampleCRString sampleLFString sampleCRLFString |
+ sampleCRString := 'Fred', String cr , 'the' , String cr , 'Bear'.
+ sampleLFString := 'Fred', String lf , 'the' , String lf , 'Bear'.
+ sampleCRLFString := 'Fred', String crlf , 'the' , String crlf , 'Bear'.
+
+ self assert: (sampleCRString lineNumber: 2) = 'the'.
+ self assert: (sampleLFString lineNumber: 2) = 'the'.
+ self assert: (sampleCRLFString lineNumber: 2) = 'the'.!

Item was added:
+ ----- Method: StringTest>>testLineCount (in category 'testing - lines') -----
+ testLineCount
+ | sampleCRString sampleLFString sampleCRLFString |
+ sampleCRString := 'Fred', String cr , 'the' , String cr , 'Bear'.
+ sampleLFString := 'Fred', String lf , 'the' , String lf , 'Bear'.
+ sampleCRLFString := 'Fred', String crlf , 'the' , String crlf , 'Bear'.
+
+ self assert: sampleCRString lineCount = 3.
+ self assert: sampleLFString lineCount = 3.
+ self assert: sampleCRLFString lineCount = 3.!

Item was added:
+ ----- Method: StringTest>>testLinesDo (in category 'testing - lines') -----
+ testLinesDo
+ | sampleCRString sampleLFString sampleCRLFString lines |
+ sampleCRString := 'Fred', String cr , 'the' , String cr , 'Bear'.
+ sampleLFString := 'Fred', String lf , 'the' , String lf , 'Bear'.
+ sampleCRLFString := 'Fred', String crlf , 'the' , String crlf , 'Bear'.
+
+ lines := OrderedCollection new.
+ sampleCRString linesDo: [:aLine |
+ self deny: (aLine includes: Character cr).
+ self deny: (aLine includes: Character lf).
+ lines add: aLine].
+ self assert: lines asArray = #('Fred' 'the' 'Bear').
+
+ lines := OrderedCollection new.
+ sampleLFString linesDo: [:aLine |
+ self deny: (aLine includes: Character cr).
+ self deny: (aLine includes: Character lf).
+ lines add: aLine].
+ self assert: lines asArray = #('Fred' 'the' 'Bear').
+
+ lines := OrderedCollection new.
+ sampleCRLFString linesDo: [:aLine |
+ self deny: (aLine includes: Character cr).
+ self deny: (aLine includes: Character lf).
+ lines add: aLine].
+ self assert: lines asArray = #('Fred' 'the' 'Bear').
+
+ !

Item was added:
+ ----- Method: StringTest>>testLineCorrespondingToIndex (in category 'testing - lines') -----
+ testLineCorrespondingToIndex
+ | sampleCRString sampleLFString sampleCRLFString anIndex |
+ sampleCRString := 'Fred', String cr , 'the' , String cr , 'Bear'.
+ sampleLFString := 'Fred', String lf , 'the' , String lf , 'Bear'.
+ sampleCRLFString := 'Fred', String crlf , 'the' , String crlf , 'Bear'.
+
+ anIndex := sampleCRString indexOf: $h.
+ self assert: (sampleCRString lineCorrespondingToIndex: anIndex) = 'the'.
+ anIndex := sampleLFString indexOf: $h.
+ self assert: (sampleLFString lineCorrespondingToIndex: anIndex) = 'the'.
+ anIndex := sampleCRLFString indexOf: $h.
+ self assert: (sampleCRLFString lineCorrespondingToIndex: anIndex) = 'the'.
+
+ anIndex := sampleCRString indexOf: $B.
+ self assert: (sampleCRString lineCorrespondingToIndex: anIndex) = 'Bear'.
+ anIndex := sampleLFString indexOf: $B.
+ self assert: (sampleLFString lineCorrespondingToIndex: anIndex) = 'Bear'.
+ anIndex := sampleCRLFString indexOf: $B.
+ self assert: (sampleCRLFString lineCorrespondingToIndex: anIndex) = 'Bear'.
+
+ anIndex := sampleCRString indexOf: $d.
+ self assert: (sampleCRString lineCorrespondingToIndex: anIndex) = 'Fred'.
+ anIndex := sampleLFString indexOf: $d.
+ self assert: (sampleLFString lineCorrespondingToIndex: anIndex) = 'Fred'.
+ anIndex := sampleCRLFString indexOf: $d.
+ self assert: (sampleCRLFString lineCorrespondingToIndex: anIndex) = 'Fred'.!