Skip to content

Commit cb1a066

Browse files
committed
test under new EVAL and interpolation rules
1 parent 1becd7c commit cb1a066

File tree

5 files changed

+36
-33
lines changed

5 files changed

+36
-33
lines changed

S04-phasers/end.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ lives-ok { EVAL 'my $x = 3; END { $a = $x * $x };' },
4444
'and those from EVAL as well';
4545

4646
#?niecza todo
47-
is_run( 'my $a = 2; EVAL q[my $x = 3; END { $a = $x * $x; print $a }]; print $a, ":"',
47+
is_run( 'use MONKEY-SEE-NO-EVAL; my $a = 2; EVAL q[my $x = 3; END { $a = $x * $x; print $a }]; print $a, ":"',
4848
{
4949
out => '2:9',
5050
err => '',

S05-interpolation/regex-in-variable.t

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version 0.3 (12 Apr 2004), file t/patvar.t.
88
99
=end pod
1010

11-
plan 54;
11+
plan 52;
1212

1313
# L<S05/Variable (non-)interpolation>
1414

@@ -39,39 +39,40 @@ ok("aaaaab" ~~ m/<$foo>/, 'Rulish scalar match 5');
3939
ok(!("aaaaab" ~~ m/$foo/), 'Rulish scalar match 6');
4040
ok(!('aaaaab' ~~ m/"$foo"/), 'Rulish scalar match 7');
4141

42-
# RT #61960
4342
{
44-
my $a = 'a';
45-
ok 'a' ~~ / $a /, 'match with string as rx works';
43+
no MONKEY-SEE-NO-EVAL;
44+
# RT #61960
45+
{
46+
my $a = 'a';
47+
ok 'a' ~~ / $a /, 'match with string as rx works';
48+
}
49+
50+
# RT #100232
51+
throws-like { my $x = '1} if say "pwnd"; #'; 'a' ~~ /<$x>/ }, X::SecurityPolicy, "particular garbage-in recognized as being garbage (see RT)";
52+
53+
# because it broke these:
54+
{
55+
ok "foo" ~~ /<{' o ** 2 '}>/, 'returns true';
56+
isa-ok "foo" ~~ /<{' o ** 2 '}>/, Match, 'returns a valid Match';
57+
is ~("foo" ~~ /<{' o ** 2 '}>/), "oo", 'returns correct Match';
58+
}
59+
60+
throws-like { 'a' ~~ /<{'$(say "trivially pwned")'}>/ }, X::SecurityPolicy, "should handle this too";
61+
throws-like { 'a' ~~ /<{' "{say q/pwnzered/}" '}>/ }, X::SecurityPolicy, "should handle this too";
62+
throws-like { 'a' ~~ /<{' "foo $_ bar " '}>/ }, X::SecurityPolicy, "should handle this too";
63+
throws-like { 'a' ~~ /<{' "foo @*ARGS[] bar " '}>/ }, X::SecurityPolicy, "should handle this too";
64+
throws-like { 'a' ~~ /<{' "foo %*ENV{} bar " '}>/ }, X::SecurityPolicy, "should handle this too";
65+
throws-like { 'a' ~~ /<{' "foo &infix:<+>() " '}>/ }, X::SecurityPolicy, "should handle this too";
66+
throws-like { 'a' ~~ /<{' :my $x = {say q/hi!/}; '}>/ }, X::SecurityPolicy, "should handle this too";
67+
throws-like { 'a' ~~ /<{' {say q/gotcha/} '}>/ }, X::SecurityPolicy, "should handle this too";
68+
throws-like { 'a' ~~ /<{' <{say q/gotcha/}> '}>/ }, X::SecurityPolicy, "should handle this too";
69+
throws-like { 'a' ~~ /<{' <?{say q/gotcha/}> '}>/ }, X::SecurityPolicy, "should handle this too";
70+
throws-like { 'a' ~~ /<{' <!{say q/gotcha/}> '}>/ }, X::SecurityPolicy, "should handle this too";
71+
throws-like { 'a' ~~ /<{' <foo=!{say q/gotcha/}> '}>/ }, X::SecurityPolicy, "should handle this too";
72+
throws-like { 'a' ~~ /<{' <alpha(say q/gotcha/)> '}>/ }, X::SecurityPolicy, "should handle this too";
73+
throws-like { 'a' ~~ /<{' "$x:(say "busted")" '}>/ }, X::SecurityPolicy, "should handle this too";
4674
}
4775

48-
# RT #100232
49-
throws-like Q[my $x = '1} if say "pwnd"; #'; 'a' ~~ /<$x>/], Exception, "particular garbage-in recognized as being garbage (see RT)";
50-
51-
# because it broke these:
52-
{
53-
ok "foo" ~~ /<{' o ** 2 '}>/, 'returns true';
54-
isa-ok "foo" ~~ /<{' o ** 2 '}>/, Match, 'returns a valid Match';
55-
is ~("foo" ~~ /<{' o ** 2 '}>/), "oo", 'returns correct Match';
56-
}
57-
58-
throws-like Q['a' ~~ /<{'$(say "trivially pwned")'}>/], Exception, "should handle this too";
59-
throws-like Q['a' ~~ /<{' "{say q/pwnzered/}" '}>/], Exception, "should handle this too";
60-
throws-like Q['a' ~~ /<{' "foo $_ bar " '}>/], Exception, "should handle this too";
61-
throws-like Q['a' ~~ /<{' "foo @*ARGS[] bar " '}>/], Exception, "should handle this too";
62-
throws-like Q['a' ~~ /<{' "foo %*ENV{} bar " '}>/], Exception, "should handle this too";
63-
throws-like Q['a' ~~ /<{' "foo &infix:<+>() " '}>/], Exception, "should handle this too";
64-
throws-like Q['a' ~~ /<{' :my $x = {say q/hi!/}; '}>/], Exception, "should handle this too";
65-
throws-like Q['a' ~~ /<{' {say q/gotcha/} '}>/], Exception, "should handle this too";
66-
throws-like Q['a' ~~ /<{' <{say q/gotcha/}> '}>/], Exception, "should handle this too";
67-
throws-like Q['a' ~~ /<{' <?{say q/gotcha/}> '}>/], Exception, "should handle this too";
68-
throws-like Q['a' ~~ /<{' <!{say q/gotcha/}> '}>/], Exception, "should handle this too";
69-
throws-like Q['a' ~~ /<{' <foo=!{say q/gotcha/}> '}>/], Exception, "should handle this too";
70-
throws-like Q['a' ~~ /<{' <alpha(say q/gotcha/)> '}> '}>/], Exception, "should handle this too";
71-
throws-like Q['a' ~~ /<{' $x:(say "busted") '}> '}>/], Exception, "should handle this too";
72-
throws-like Q['a' ~~ /<{' "$x:(say "busted")" '}> '}>/], Exception, "should handle this too";
73-
throws-like Q['a' ~~ /<{' q/\qq[{say "busted"}]/ '}> '}>/], Exception, "should handle this too";
74-
7576
# Arrays
7677

7778
ok("a" ~~ m/@var/, 'Simple array match (a)');

S05-metasyntax/angle-brackets.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ character classes), and those are referenced at the correct spot.
258258
# meanings within regexes that the bare elipses have in ordinary code
259259
#?niecza skip 'Action method assertion:sym<???> not yet implemented'
260260
{
261-
throws-like '"foo" ~~ /<...>/', X::Comp::Group, '<...> dies in regex match';
261+
throws-like '"foo" ~~ /<...>/', Exception, '<...> dies in regex match';
262262
# XXX: Should be warns_ok, but we don't have that yet
263263
lives-ok({'foo' ~~ /<???>/}, '<???> lives in regex match');
264264
#?rakudo todo '!!! in regexes'

S05-metasyntax/litvar.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ $var = '$i';
7474
throws-like { EVAL '"foo" ~~ /<$var>/' }, X::Undeclared, symbol => '$i',
7575
'undeclared var in assertion in interpolated string throws';
7676
{
77+
no MONKEY-SEE-NO-EVAL;
7778
my $i = 'f+o';
7879
$var = '$i';
7980
is "foo" ~~ /<$var>/, Nil,

S11-modules/require.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use v6;
22

33
use lib '.';
4+
use MONKEY-SEE-NO-EVAL;
45

56
my $required-Test = (require Test <&plan &is &lives-ok &skip &todo>);
67

0 commit comments

Comments
 (0)