Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.122.mcz==================== Summary ====================
Name: CollectionsTests-nice.122
Author: nice
Time: 7 December 2009, 10:05:49 am
UUID: b2c888de-4917-0f46-b3f7-efd6f209468e
Ancestors: CollectionsTests-ul.121
Some basic tests for nextLine upToAnyOf: upToAnyOf:do:
=============== Diff against CollectionsTests-ul.121 ===============
Item was added:
+ ----- Method: ReadStreamTest>>testNextLine (in category 'tests - accessing') -----
+ testNextLine
+ | lines text stream |
+ lines := #('line 1' ' and line 2' '' 'fourth').
+ text := lines first , String cr , lines second , String crlf , lines third , String lf , lines fourth.
+ stream := text readStream.
+ lines do: [:e |
+ self assert: stream nextLine = e].
+ self assert: stream nextLine = nil!
Item was added:
+ ----- Method: ReadStreamTest>>testUpToAnyOf (in category 'tests - accessing') -----
+ testUpToAnyOf
+ | stream |
+ stream := 'abcde' readStream.
+ self assert: (stream upToAnyOf: String crlf) = 'abcde'.
+ self assert: stream atEnd.
+
+ stream := 'abcde' readStream.
+ self assert: (stream upToAnyOf: 'dc') = 'ab'.
+ self assert: stream upToEnd = 'de'.
+
+ stream := #( 1 2 nil true false 10 ) readStream.
+ self assert: (stream upToAnyOf: #(100 1000)) = #( 1 2 nil true false 10 ).
+ self assert: stream atEnd.
+
+ stream := #( 1 2 nil true false 10 ) readStream.
+ self assert: (stream upToAnyOf: #( true false )) = #( 1 2 nil ).
+ self assert: stream upToEnd = #( false 10 ).!
Item was added:
+ ----- Method: ReadStreamTest>>testUpToAnyOfDo (in category 'tests - accessing') -----
+ testUpToAnyOfDo
+ | stream found |
+ found := false.
+ stream := 'abcde' readStream.
+ self assert: (stream upToAnyOf: String crlf do: [:char | found := true]) = 'abcde'.
+ self assert: stream atEnd.
+ self deny: found.
+
+ found := Object new.
+ stream := 'abcde' readStream.
+ self assert: (stream upToAnyOf: 'dc' do: [:char | found := char]) = 'ab'.
+ self assert: found = $c.
+ self assert: stream upToEnd = 'de'.
+
+ found := false.
+ stream := #( 1 2 nil true false 10 ) readStream.
+ self assert: (stream upToAnyOf: #(100 1000) do: [:anObject | found := true]) = #( 1 2 nil true false 10 ).
+ self deny: found.
+ self assert: stream atEnd.
+
+ found := Object new.
+ stream := #( 1 2 nil true false 10 ) readStream.
+ self assert: (stream upToAnyOf: #( true false ) do: [:anObject | found := anObject]) = #( 1 2 nil ).
+ self assert: found = true.
+ self assert: stream upToEnd = #( false 10 ).!