Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
We now pass 45-smartmatch.t.
  • Loading branch information
jnthn committed Feb 21, 2013
1 parent bb49a80 commit 6375842
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions t/nqp/45-smartmatch.t
@@ -0,0 +1,23 @@
#! nqp

plan(10);

my $match := 'cde' ~~ regex abc { c(.)e };

ok( $match, "simple smart match" );
ok( $match.from == 0, "match has correct .from" );
ok( $match.to == 3, "match has correct .to");
ok( $match eq 'cde', "match has correct string value" );

$match := 'abcdef' ~~ regex abc { c(.)e };
ok( !$match, "'regex' form doesn't do :c-like scanning" );

$match := 'abcdef' ~~ / c(.)e /;
ok( $match, "simple smart match, scanning form" );
ok( $match.from == 2, "match has correct .from" );
ok( $match.to == 5, "match has correct .to");
ok( $match eq 'cde', "match has correct string value" );

$match := 'abcdef' ~~ / '' /;
ok( $match, "successfully match empty string (TT #1376)");

0 comments on commit 6375842

Please sign in to comment.