Changeset 21153

Show
Ignore:
Timestamp:
07/02/08 00:35:29 (5 months ago)
Author:
moritz
Message:

[spec] fixed tests for return of failed Str.index(). bacek++, pmichaud++

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S29-str/index.t

    r20937 r21153  
    88# Simple - with just a single char 
    99 
     10 
    1011is(index("Hello World", "H"), 0, "One char, at beginning"); 
    1112is(index("Hello World", "l"), 2, "One char, in the middle"); 
    1213is(index("Hello World", "d"), 10, "One char, in the end"); 
    13 is(index("Hello World", "x"), -1, "One char, no match"); 
     14ok(!defined(index("Hello World", "x")), "One char, no match"); 
    1415 
    1516is(index("Hello World", "l", 0), 2, "One char, find first match, pos = 0"); 
     
    1718is(index("Hello World", "l", 3), 3, "- 2. match"); 
    1819is(index("Hello World", "l", 4), 9, "- 3. match"); 
    19 is(index("Hello World", "l", 10), -1, "- no more matches"); 
     20ok(!defined(index("Hello World", "l", 10)), "- no more matches"); 
    2021 
    2122# Simple - with a string 
     
    2425is(index("Hello World", "o W"), 4, "Substr, in the middle"); 
    2526is(index("Hello World", "World"), 6, "Substr, at the end"); 
    26 is(index("Hello World", "low"), -1, "Substr, no match"); 
     27ok(!defined(index("Hello World", "low")), "Substr, no match"); 
    2728is(index("Hello World", "Hello World"), 0, "Substr eq Str"); 
    2829 
     
    3132is(index("Hello World", ""), 0, "Substr is empty"); 
    3233is(index("", ""), 0, "Both strings are empty"); 
    33 is(index("", "Hello"), -1, "Only main-string is empty"); 
     34ok(!index("", "Hello") "Only main-string is empty"); 
    3435is(index("Hello", "", 3), 3, "Substr is empty, pos within str"); 
    3536is(index("Hello", "", 5), 5, "Substr is empty, pos at end of str");