~ubuntu-branches/ubuntu/vivid/nqp/vivid-proposed

« back to all changes in this revision

Viewing changes to t/nqp/80-matches.t

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-11-01 12:09:18 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131101120918-kx51sl0sxl3exsxi
Tags: 2013.10-1
* New upstream release
* Bump versioned (Build-)Depends on parrot
* Update patches
* Install new README.pod
* Fix vcs-field-not-canonical
* Do not install rubyish examples
* Do not Depends on parrot-devel anymore
* Add 07_disable-serialization-tests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
plan(10);
 
2
my $match := 'abcdef' ~~ / c(.)<alpha> /;
 
3
ok( $match eq 'cde', "simple match" );
 
4
for $match.list {
 
5
  ok($_ eq 'd','correct numbered capture');
 
6
}
 
7
for $match.hash {
 
8
  ok($_.key eq 'alpha','the named capture is named correctly');
 
9
  ok($_.value eq 'e','...and it contains the right things');
 
10
}
 
11
ok( $match.from == 2, ".from works" );
 
12
ok( $match.to == 5, ".to works");
 
13
ok( $match.orig eq "abcdef", ".orig works");
 
14
ok( $match.chars == 3, ".chars works");
 
15
 
 
16
 
 
17
ok($match."!dump_str"('mob') eq "mob: cde @ 2\nmob[0]: d @ 3\nmob<alpha>: e @ 4\n",".\"!dump_str\" works correctly");
 
18
 
 
19
grammar ABC {
 
20
    token TOP { (o)(k) ' ' <integer> }
 
21
    token integer { \d+ }
 
22
}
 
23
 
 
24
$match := ABC.parse('ok 123');
 
25
ok($match.dump eq "- 0: o\n- 1: k\n- integer: 123\n",".dump works correctly");