File tree Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change 1
1
use v6 ;
2
2
use Test ;
3
3
4
- plan 1 ;
4
+ plan 2 ;
5
5
6
- # L<S29/Context/"=item evalfile ">
6
+ # L<S29/Context/"=item EVALFILE ">
7
7
8
8
sub nonce () { return (" .{ $ * PID } ." ~ 1000 . rand . Int ) }
9
9
10
- my $ tmpfile = " temp-evalfile" ~ nonce ();
11
10
{
12
- my $ fh = open (" $ tmpfile" , : w);
13
- say $ fh : " 32 + 10" ;
14
- close $ fh ;
11
+ my $ tmpfile = " temp-evalfile" ~ nonce ();
12
+ {
13
+ my $ fh = open (" $ tmpfile" , : w);
14
+ say $ fh : " 32 + 10" ;
15
+ close $ fh ;
16
+ }
17
+ is EVALFILE($ tmpfile ), 42 , " EVALFILE() works" ;
18
+ END { unlink $ tmpfile }
15
19
}
16
20
17
- # ?rakudo skip 'RT #125294 - evalfile NYI'
18
- is evalfile ($ tmpfile ), 42 , " evalfile() works" ;
19
-
20
- END { unlink $ tmpfile }
21
+ {
22
+ my $ tmpfile = " temp-evalfile-lexical" ~ nonce ();
23
+ {
24
+ my $ fh = open (" $ tmpfile" , : w);
25
+ say $ fh : ' $some_var' ;
26
+ close $ fh ;
27
+ }
28
+ my $ some_var = ' samovar' ;
29
+ is EVALFILE($ tmpfile ), ' samovar' , " EVALFILE() evaluated code can see lexicals" ;
30
+ END { unlink $ tmpfile }
31
+ }
21
32
22
33
# vim: ft=perl6
You can’t perform that action at this time.
0 commit comments