Skip to content

Commit ba20490

Browse files
committed
add test file for checking methods on Match objects
1 parent 309defc commit ba20490

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

S05-capture/match-object.t

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use v6;
2+
use Test;
3+
4+
# this file should become the test for systematically testing
5+
# Match objects. Exception: .caps and .chunks are tested in caps.t
6+
7+
plan 12;
8+
9+
ok 'ab12de' ~~ /\d+/, 'match successful';
10+
is $/.WHAT.gist, Match.gist, 'got right type';
11+
ok $/.Bool, '.Bool';
12+
ok $/.defined, '.defined';
13+
is $/.Str, '12', '.Str';
14+
is $/.from, 2, '.from';
15+
is $/.to, 4, '.to';
16+
is $/.prematch, 'ab', '.prematch';
17+
is $/.postmatch, 'de', '.postmatch';
18+
19+
nok 'abde' ~~ /\d/, 'no match';
20+
nok $/.Bool, 'failed match is False';
21+
is $/.Str, '', 'false match stringifies to empty string';

0 commit comments

Comments
 (0)