Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unfudge/rewrite some tests for END phaser
* use 'lives-ok' with EVAL instead of 'eval-lives-ok'
* one 'todo' test only failed because $a was not visible within 'eval-lives-ok'
* the second 'todo' test needed a rewrite with 'is_run'
  • Loading branch information
usev6 committed Sep 19, 2015
1 parent 05eed96 commit c48ef39
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions S04-phasers/end.t
Expand Up @@ -31,21 +31,25 @@ plan 8;
}
}

eval-lives-ok 'my $x = 3; END { $x * $x }',
'outer lexicals are visible in END { ... } blocks';

# RT #112408
eval-lives-ok 'my %rt112408 = END => "parsing clash with block-less END"',
lives-ok { EVAL 'my %rt112408 = END => "parsing clash with block-less END"' },
'Can use END as a bareword hash key (RT 112408)';

lives-ok { EVAL 'my $x = 3; END { $x * $x }' },
'outer lexicals are visible in END { ... } blocks';

my $a = 0;
#?rakudo 2 todo 'lexicals and EVAL() RT #124963'
#?niecza todo
eval-lives-ok 'my $x = 3; END { $a = $x * $x };',
'and those from eval as well';
lives-ok { EVAL 'my $x = 3; END { $a = $x * $x };' },
'and those from EVAL as well';

#?niecza todo
is $a, 9, 'and they really worked';
is_run( 'my $a = 2; EVAL q[my $x = 3; END { $a = $x * $x; print $a }]; print $a, ":"',
{
out => '2:9',
err => '',
},
'and they really worked' );

END { pass("exit does not prevent running of END blocks"); }
exit;
Expand Down

0 comments on commit c48ef39

Please sign in to comment.