Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 37 lines (26 sloc) 1.075 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#! nqp

#P6metaclass.register('Integer');
#P6metaclass.register('ResizablePMCArray');

plan(14);

skip('boxing');
#ok(3 ~~ Integer, "smartmatch of Integer works");
skip('boxing');
#ok(!(4.5 ~~ Integer), "negative smartmatch of Integer works");

skip('boxing');
#ok(<a b c> ~~ ResizablePMCArray, "smartmatch of RPA works");
skip('boxing');
#ok(!(3 ~~ ResizablePMCArray), "negative smartmatch of RPA works");

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)");

Something went wrong with that request. Please try again.