Skip to content

Commit fdbe891

Browse files
committed
Finish S02-names/pseudo.t
1 parent 9aed4c2 commit fdbe891

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

S02-names/pseudo.t

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 128;
5+
plan 140;
66

77
# I'm not convinced this is in the right place
88
# Some parts of this testing (i.e. WHO) seem a bit more S10ish -sorear
@@ -351,7 +351,33 @@ plan 128;
351351
}
352352

353353
# UNIT
354+
my $x110 = 110; #OK
355+
{
356+
my $x110 = 111; #OK
357+
my $unit = "UNIT";
358+
is $UNIT::x110, 110, '$UNIT:: works';
359+
is $::($unit)::x110, 110, '::("UNIT") works';
360+
is eval('my $x110 = 112; $UNIT::x110'), 112, '$UNIT:: finds eval heads';
361+
is eval('my $x110 = 112; $::($unit)::x110 #OK'), 112, '::("UNIT") finds eval heads';
362+
my $f = eval('my $x110 is dynamic = 113; -> $fn { my $x110 is dynamic = 114; $fn(); } #OK');
363+
is $f({ $CALLER::UNIT::x110 }), 113, 'CALLER::UNIT works';
364+
is $f({ $CALLER::($unit)::x110 }), 113, 'CALLER::UNIT works (indirect)';
365+
}
366+
354367
# SETTING
355-
# PARENT
368+
{
369+
sub not($x) { $x } #OK
370+
my $setting = 'SETTING';
371+
ok &SETTING::not(False), 'SETTING:: works';
372+
ok &::($setting)::not.(False), '::("SETTING") works';
373+
374+
ok eval('&SETTING::not(True)'), 'SETTING finds eval context';
375+
ok eval('&::($setting)::not(True)'), '::("SETTING") finds eval context';
376+
my $f = eval('-> $fn { $fn(); }');
377+
ok $f({ &CALLER::SETTING::not(True) }), 'CALLER::SETTING works';
378+
ok $f({ &CALLER::($setting)::not(True) }), 'CALLER::SETTING works (ind)';
379+
}
380+
381+
# PARENT - NYI in any compiler
356382

357383
# vim: ft=perl6

0 commit comments

Comments
 (0)