[squeak-dev] The Trunk: CollectionsTests-nice.113.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Nov 16 21:28:05 UTC 2009


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

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

Name: CollectionsTests-nice.113
Author: nice
Time: 16 November 2009, 10:27:57 am
UUID: aa10c4ac-e4d9-4c6c-8f96-40b454455b23
Ancestors: CollectionsTests-nice.112

Harder test for #withNoLineLongerThan:

=============== Diff against CollectionsTests-nice.112 ===============

Item was changed:
  ----- Method: StringTest>>testWthNoLineLongerThan (in category 'testing - lines') -----
  testWthNoLineLongerThan
  	| phrases |
  	phrases := {
  		'Fred the bear went down to the brook to read his book in silence'.
  		'Fred the bear went down' , String cr , ' to the brook to ' , String cr , 'read his book in silence'.
  		'Fred the bear went down' , String lf , '  to the brook to ' , String lf , 'read his book in silence'.
  		'Fred the bear went down' , String crlf , '  to the brook to ' , String crlf , 'read his book in silence'.
  		}.
  	#(5 7 9) do: [:length |
  		phrases do: [:phrase |
  			| split |
  			split := phrase withNoLineLongerThan: length.
  			self
  				assert: (split copyWithoutAll: CharacterSet separators) = (phrase copyWithoutAll: CharacterSet separators)
  				description: 'no information should be lost'.
  			split linesDo: [:line |
+ 				self assert: line size <= length description: 'lines should not be longer than prescribed'].
+ 			phrase lineCount = 1 ifTrue: [| lastLineSize |
+ 				lastLineSize := length.
+ 				split linesDo: [:line |
+ 					line isEmpty ifFalse: [| firstWordSize |
+ 						firstWordSize := line indexOfAnyOf: CharacterSet separators startingAt: 1 ifAbsent: [line size + 1].
+ 						self assert: (lastLineSize + firstWordSize) > length description: 'split was too short'.
+ 						lastLineSize := line size]]]]]!
- 				self assert: line size <= length description: 'lines should not be longer than prescribed']]]!




More information about the Squeak-dev mailing list