[Newbies] testIndexOf test failure

Edward Mokurai Cherlin mokurai at sugarlabs.org
Sat Aug 25 20:51:44 UTC 2012


On page 24 of Squeak by Example it says to run the tests in
CollectionsTest-Text, including a newly-defined method, testShout. In a fresh
Squeak 3.9 I get an unexpected assertion failure for StringTest>>#TestIndexOf,
which is defined as.

testIndexOf
	
	"test for http://bugs.impara.de/view.php?id=3574"
	self assert: ('abc-' asWideString indexOfAnyOf: (CharacterSet newFrom: '
-0123456789')) = 4.
	self assert: ('ab7' asWideString indexOfAnyOf: (CharacterSet newFrom: '
-0123456789')) = 3.
	self assert: ('a2c' asWideString indexOfAnyOf: (CharacterSet newFrom: '
-0123456789')) = 2.
	self assert: ('3bc' asWideString indexOfAnyOf: (CharacterSet newFrom: '
-0123456789')) = 1.
	self assert: ('abc' asWideString indexOfAnyOf: (CharacterSet newFrom: '
-0123456789')) = 0.
	
	"extension to wide characters"
	self assert: ((String with: 803 asCharacter with: 811 asCharacter)
indexOfAnyOf: (CharacterSet newFrom: (String with: 811 asCharacter with: 812
asCharacter))) = 2.
	
	self assert: ('abc' indexOfAnyOf: (CharacterSet newFrom: (String with: 811
asCharacter with: 812 asCharacter))) = 0.
	
	self assert: ('abc' indexOfAnyOf: (CharacterSet newFrom: (String with: 811
asCharacter with: $c))) = 3.


I don't know how to copy the error messages from the TestFailure window. I have
not yet started to learn the debugger, so I am at a lost to find out more.

Any suggestions?



More information about the Beginners mailing list