Changeset 21153
- Timestamp:
- 07/02/08 00:35:29 (5 months ago)
- Files:
-
- 1 modified
-
t/spec/S29-str/index.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S29-str/index.t
r20937 r21153 8 8 # Simple - with just a single char 9 9 10 10 11 is(index("Hello World", "H"), 0, "One char, at beginning"); 11 12 is(index("Hello World", "l"), 2, "One char, in the middle"); 12 13 is(index("Hello World", "d"), 10, "One char, in the end"); 13 is(index("Hello World", "x"), -1, "One char, no match");14 ok(!defined(index("Hello World", "x")), "One char, no match"); 14 15 15 16 is(index("Hello World", "l", 0), 2, "One char, find first match, pos = 0"); … … 17 18 is(index("Hello World", "l", 3), 3, "- 2. match"); 18 19 is(index("Hello World", "l", 4), 9, "- 3. match"); 19 is(index("Hello World", "l", 10), -1, "- no more matches");20 ok(!defined(index("Hello World", "l", 10)), "- no more matches"); 20 21 21 22 # Simple - with a string … … 24 25 is(index("Hello World", "o W"), 4, "Substr, in the middle"); 25 26 is(index("Hello World", "World"), 6, "Substr, at the end"); 26 is(index("Hello World", "low"), -1, "Substr, no match");27 ok(!defined(index("Hello World", "low")), "Substr, no match"); 27 28 is(index("Hello World", "Hello World"), 0, "Substr eq Str"); 28 29 … … 31 32 is(index("Hello World", ""), 0, "Substr is empty"); 32 33 is(index("", ""), 0, "Both strings are empty"); 33 is(index("", "Hello"), -1,"Only main-string is empty");34 ok(!index("", "Hello") "Only main-string is empty"); 34 35 is(index("Hello", "", 3), 3, "Substr is empty, pos within str"); 35 36 is(index("Hello", "", 5), 5, "Substr is empty, pos at end of str");
