Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 24 lines (16 sloc) 0.686 kb
2f65563 @pmichaud Initial version of smartmatch operator.
pmichaud authored
1 #! nqp
2
0fa77cc @jnthn Foss some tests that haven't been run for a long time.
jnthn authored
3 plan(10);
2f65563 @pmichaud Initial version of smartmatch operator.
pmichaud authored
4
01c9533 @pmichaud Refactoring for Regex::Method.
pmichaud authored
5 my $match := 'cde' ~~ regex abc { c(.)e };
fe021de @pmichaud Add ability to smartmatch regex/token/rule (although anchoring is
pmichaud authored
6
7 ok( $match, "simple smart match" );
01c9533 @pmichaud Refactoring for Regex::Method.
pmichaud authored
8 ok( $match.from == 0, "match has correct .from" );
9 ok( $match.to == 3, "match has correct .to");
fe021de @pmichaud Add ability to smartmatch regex/token/rule (although anchoring is
pmichaud authored
10 ok( $match eq 'cde', "match has correct string value" );
11
01c9533 @pmichaud Refactoring for Regex::Method.
pmichaud authored
12 $match := 'abcdef' ~~ regex abc { c(.)e };
13 ok( !$match, "'regex' form doesn't do :c-like scanning" );
14
5a0677a @pmichaud Add /.../ form of regexes and matching.
pmichaud authored
15 $match := 'abcdef' ~~ / c(.)e /;
16 ok( $match, "simple smart match, scanning form" );
17 ok( $match.from == 2, "match has correct .from" );
18 ok( $match.to == 5, "match has correct .to");
19 ok( $match eq 'cde', "match has correct string value" );
20
9652695 @pmichaud Fix empty string in regexes (TT #1376, fperrad++).
pmichaud authored
21 $match := 'abcdef' ~~ / '' /;
22 ok( $match, "successfully match empty string (TT #1376)");
23
Something went wrong with that request. Please try again.