|
2 | 2 |
|
3 | 3 | use Test;
|
4 | 4 |
|
5 |
| -plan 128; |
| 5 | +plan 140; |
6 | 6 |
|
7 | 7 | # I'm not convinced this is in the right place
|
8 | 8 | # Some parts of this testing (i.e. WHO) seem a bit more S10ish -sorear
|
@@ -351,7 +351,33 @@ plan 128;
|
351 | 351 | }
|
352 | 352 |
|
353 | 353 | # 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 | + |
354 | 367 | # 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 |
356 | 382 |
|
357 | 383 | # vim: ft=perl6
|
0 commit comments