Skip to content

Commit 367f23b

Browse files
committed
s/evalfile/EVALFILE/, add lexical visibility test.
1 parent 5aa29ab commit 367f23b

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

S29-context/evalfile.t

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
use v6;
22
use Test;
33

4-
plan 1;
4+
plan 2;
55

6-
# L<S29/Context/"=item evalfile">
6+
# L<S29/Context/"=item EVALFILE">
77

88
sub nonce () { return (".{$*PID}." ~ 1000.rand.Int) }
99

10-
my $tmpfile = "temp-evalfile" ~ nonce();
1110
{
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 }
1519
}
1620

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+
}
2132

2233
# vim: ft=perl6

0 commit comments

Comments
 (0)