File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ use v6 ;
2
+ use Test ;
3
+ plan 4 ;
4
+
5
+ my $ a ;
6
+ nok $ a . VAR . dynamic, ' Variables default to not being dynamically scoped' ;
7
+
8
+ subtest ' Pragma dynamic-scope without args' => {
9
+ use dynamic-scope;
10
+ my $ b ;
11
+ ok $ b . VAR . dynamic, ' Works on normal variable declarations' ;
12
+ my ($ c , $ d );
13
+ ok $ c . VAR . dynamic, ' Works on variables declared in list form (1)' ;
14
+ ok $ d . VAR . dynamic, ' Works on variables declared in list form (2)' ;
15
+ }
16
+
17
+ my $ x ;
18
+ nok $ x . VAR . dynamic, ' The dynamic-scope pragma works lexically' ;
19
+
20
+ subtest ' Pragma dynamic-scope with args' => {
21
+ use dynamic-scope <$e $g >;
22
+ my $ e ;
23
+ ok $ e . VAR . dynamic, ' Works on normal variable declarations with matching name' ;
24
+ my $ f ;
25
+ nok $ f . VAR . dynamic, ' Does not make variables without matching name dynamic' ;
26
+ my ($ g , $ h );
27
+ ok $ g . VAR . dynamic, ' Works on variables declared in list form (1)' ;
28
+ nok $ h . VAR . dynamic, ' Works on variables declared in list form (2)' ;
29
+ }
30
+
31
+ # vim: ft=perl6
You can’t perform that action at this time.
0 commit comments