#REFACTORING
class: RegressionTests::StringTests
class definition
added:16 methods
--- a/RegressionTests__StringTests.st Thu Feb 11 14:30:45 2016 +0100
+++ b/RegressionTests__StringTests.st Thu Feb 11 14:48:14 2016 +0100
@@ -285,8 +285,21 @@
s := 'Some Sample Generators (74035660-d1f6-11df-9ab3-00ff7b08316c)'.
1 to:s size do:[:start |
- i := s indexOfAny:'-' startingAt:start.
- self assert:(i == 0 or:[ i >= start]).
+ i := s indexOfAny:'-' startingAt:start.
+ self assert:(i == 0 or:[ i >= start]).
+ (i ~~ 0) ifTrue:[
+ self assert:(s at:i) == $-
+ ].
+ ].
+ "/ 123456789012
+ s := 'bla bla 1234'.
+ 1 to:s size do:[:start |
+ i := s indexOfAny:'1234' startingAt:start.
+ self assert:(i == 0 or:[ i >= start]).
+ (i == 9) ifTrue:[ self assert:((s at:i) == $1) ].
+ (i == 10) ifTrue:[ self assert:((s at:i) == $2) ].
+ (i == 11) ifTrue:[ self assert:((s at:i) == $3) ].
+ (i == 12) ifTrue:[ self assert:((s at:i) == $4) ].
].
"
@@ -296,6 +309,19 @@
"Created: / 29-10-2010 / 14:58:21 / cg"
!
+test41_contains
+ |s|
+
+ s := 'abcdefg'.
+ self assert:(s contains:[:ch | ch == $a]).
+ self assert:(s contains:[:ch | ch == $A]) not.
+ self assert:(s contains:[:ch | ch == $1]) not.
+
+ "
+ self new test41_contains
+ "
+!
+
test50_indexOf
|s i|