/
test2.pl
51 lines (43 loc) · 1.08 KB
/
test2.pl
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# vim: ft=perl6
use Test;
use MONKEY_TYPING;
ok !('xy' ~~ /x <{ False }> y/), '<{False}> blocks a match';
ok 'xy' ~~ /x <{ True }> y/, '<{True}> does not affect it';
{
my $b = "oo";
is ("foox" ~~ /f$b/), "foo", '$x matches contents in a regex';
our role Stop4717[$a] {
token foo { $a }
}
grammar X {
token TOP { [ <foo> | foo ]: x }
}
ok (X but OUR::Stop4717["foobar"]).parse("foobarx"),
"LTM works through parameterized role variables";
}
#is $?FILE, 'test.pl', '$?FILE works';
#is $?ORIG.substr(0,5), '# vim', '$?ORIG works';
# {
# {
# our $x = 5; #OK
# }
# ok $::x == 5, '$::x finds our variable';
#
# package Fao { our $y = 6; } #OK
# ok $::Fao::y == 6, '$::Fao::y works as $Fao::y';
#
# { class Mao { } }
# ok ::Mao.new.defined, 'can use classes via ::Mao';
# }
#
# {
# my $x = 7; #OK
# ok $::x == 7, '$::x can find lexicals';
# class A3 {
# method moo { 42 }
# class B4 {
# ok ::A3.moo, '::A3 can find outer classes';
# }
# }
# }
done-testing;