Changeset 22028

Show
Ignore:
Timestamp:
08/24/08 12:51:19 (3 months ago)
Author:
bacek
Message:

[spec] Str.rindex: Replace comparition to -1 with checking defined() according to spec

Files:
1 modified

Legend:

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

    r22027 r22028  
    1111is(rindex("Hello World", "l"), 9, "One char, in the middle"); 
    1212is(rindex("Hello World", "d"), 10, "One char, in the end"); 
    13 is(rindex("Hello World", "x"), -1, "One char, no match"); 
     13ok(!defined(rindex("Hello World", "x")), "One char, no match"); 
    1414 
    1515is(rindex("Hello World", "l", 10), 9, "One char, first match, pos @ end"); 
     
    1717is(rindex("Hello World", "l", 8), 3, "- 2. match"); 
    1818is(rindex("Hello World", "l", 2), 2, "- 3. match"); 
    19 is(rindex("Hello World", "l", 1), -1, "- no more matches"); 
     19ok(!defined(rindex("Hello World", "l", 1)), "- no more matches"); 
    2020 
    2121# Simple - with a string 
     
    2424is(rindex("Hello World", "o W"), 4, "Substr, in the middle"); 
    2525is(rindex("Hello World", "World"), 6, "Substr, at the end"); 
    26 is(rindex("Hello World", "low"), -1, "Substr, no match"); 
     26ok(!defined(rindex("Hello World", "low")), "Substr, no match"); 
    2727is(rindex("Hello World", "Hello World"), 0, "Substr eq Str"); 
    2828 
     
    3131is(rindex("Hello World", ""), 11, "Substr is empty"); 
    3232is(rindex("", ""), 0, "Both strings are empty"); 
    33 is(rindex("", "Hello"), -1, "Only main-string is empty"); 
     33ok(!defined(rindex("", "Hello")), "Only main-string is empty"); 
    3434is(rindex("Hello", "", 3), 3, "Substr is empty, pos within str"); 
    3535is(rindex("Hello", "", 5), 5, "Substr is empty, pos at end of str");