Skip to content

Commit 26adef6

Browse files
committed
[unicode-grant] run indexicim through all of the indexic tests
At least for all the tests written in this file, indexic and indexicim should both return the same result. Run all the tests through indexicim so that it can get more thorough testing.
1 parent c684890 commit 26adef6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

t/moar/08-indexic.t

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env nqp
2-
plan(119);
2+
plan(119 * 2);
33
my @array :=
44
# (haystack, needle, result)
55
# line below is a todo example: commented out in case someone else needs to todo one of these tests
6-
## ('chars that expand on casefolding at the end are broken with equatic', 1),
6+
## todo example: ('chars that expand on casefolding at the end are broken with equatic', 1),
77
# Make sure it doesn't find a partial match at end of the haystack and then
88
# return a partial match.
99
('st', 'sta', -1),
@@ -33,6 +33,8 @@ for @array -> $elem {
3333
else {
3434
is( nqp::indexic($elem[0], $elem[1], 0), $elem[2],
3535
"nqp::indexic('" ~ $elem[0] ~ "', " ~ $elem[1] ~ "', 0)");
36+
is( nqp::indexicim($elem[0], $elem[1], 0), $elem[2],
37+
"nqp::indexic('" ~ $elem[0] ~ "', " ~ $elem[1] ~ "', 0)");
3638
}
3739
}
3840
test-it('', 'st', 20, 1);
@@ -45,6 +47,7 @@ test-it('stbbbbbbbbbbbbbbbbbbbbbb', 'st', 20, 2);
4547
for (0,1,2,3,4,5,6) -> $val {
4648
my str $letter := nqp::chr($val + nqp::ord('A'));
4749
is( nqp::indexic('ABCDEFG', $letter, 0), $val, "nqp::indexic('ABCDEFG', '$letter', $val)");
50+
is( nqp::indexicim('ABCDEFG', $letter, 0), $val, "nqp::indexicim('ABCDEFG', '$letter', $val)");
4851
}
4952
# TODO comment on what the options for this function do…
5053
# $opt: Bitfield type
@@ -65,6 +68,11 @@ sub test-it ($needle, $text, $max, $opt) {
6568
$expect,
6669
"nqp::indexic(haystack = '$str', needle = '$needle', 0) == " ~ $expect
6770
);
71+
is(
72+
nqp::indexicim($str, $needle, 0),
73+
$expect,
74+
"nqp::indexicim(haystack = '$str', needle = '$needle', 0) == " ~ $expect
75+
);
6876
$i++
6977
}
7078
}

0 commit comments

Comments
 (0)