@@ -3,7 +3,7 @@ use lib 't/spec/packages';
3
3
4
4
use Test ;
5
5
use Test ::Util;
6
- plan 17 ;
6
+ plan 40 ;
7
7
8
8
# L<S02/Closures/"A bare closure also interpolates in double-quotish context.">
9
9
@@ -81,9 +81,64 @@ line 4
81
81
82
82
# RT #129257
83
83
{
84
- is 「 %%one @@two &&three rt%%one@@two&&three rt%% one@@ two&& three@@」 ,
85
- " %% one @@ two && three rt%% one @@ two && three rt%% one@@ two&& three@@" ,
86
- ' %%, @@, and && do not attempt to interpolate any variables' ;
84
+ is " %% one @@ two && three rt%% one @@ two && three rt%% one@@ two&& three@@" ,
85
+ 「 %%one @@two &&three rt%%one@@two&&three rt%% one@@ two&& three@@」 ,
86
+ ' bracketless %%, @@, and && do not attempt to interpolate any variables' ;
87
+
88
+ is " @% one @& two @&% three @%& four %@ one %& two %&@ three %@& four &@ one &% two &%@ three &@% four" ,
89
+ 「 @%one @&two @&%three @%&four %@one %&two %&@three %@&four &@one &%two &%@three &@%four」 ,
90
+ ' and various mixtures do not attempt to interpolate any variables' ;
91
+
92
+ my $ x = ' DX' ;
93
+ is " %%$ x @@$ x &&$ x" ,
94
+ 「 %%DX @@DX &&DX」 ,
95
+ ' bracketless %%, @@, and && do not suppress following scalar interpolation' ;
96
+
97
+ is " @%$ x @&$ x @&%$ x @%&$ x %@$ x %&$ x %&@$ x %@&$ x &@$ x &%$ x &%@$ x &@%$ x" ,
98
+ 「 @%DX @&DX @&%DX @%&DX %@DX %&DX %&@DX %@&DX &@DX &%DX &%@DX &@%DX」 ,
99
+ ' and various mixtures do not supress subsequent scalar interpolation' ;
100
+
101
+ is " %%@@&&@%@&@&%@%&%@%&%&@%@&&@&%&%@&@%$ x" ,
102
+ 「 %%@@&&@%@&@&%@%&%@%&%&@%@&&@&%&%@&@%DX」 ,
103
+ ' and it really does not matter how many there are before the $' ;
104
+
105
+ throws-like ' "@$whoopsies[]"' , X::Undeclared , symbol => ' $whoopsies' ;
106
+ throws-like ' "%$whoopsies{}"' , X::Undeclared , symbol => ' $whoopsies' ;
107
+ throws-like ' "&$whoopsies()"' , X::Undeclared , symbol => ' $whoopsies' ;
108
+
109
+ throws-like ' "@@whoopsies[]"' , X::Undeclared , symbol => ' @whoopsies' ;
110
+ throws-like ' "%@whoopsies{}"' , X::Undeclared , symbol => ' @whoopsies' ;
111
+ throws-like ' "&@whoopsies()"' , X::Undeclared , symbol => ' @whoopsies' ;
112
+
113
+ throws-like ' "@%whoopsies[]"' , X::Undeclared , symbol => ' %whoopsies' ;
114
+ throws-like ' "%%whoopsies{}"' , X::Undeclared , symbol => ' %whoopsies' ;
115
+ throws-like ' "&%whoopsies()"' , X::Undeclared , symbol => ' %whoopsies' ;
116
+
117
+ throws-like ' "@&whoopsies[]"' , X::Undeclared::Symbols ;
118
+ throws-like ' "%&whoopsies{}"' , X::Undeclared::Symbols ;
119
+ throws-like ' "&&whoopsies()"' , X::Undeclared::Symbols ;
120
+
121
+ # make sure existing refs don't fail
122
+
123
+ my $ aref = [' value' ];
124
+ my $ href = {: value};
125
+ my $ cref = {42 };
126
+
127
+ throws-like ' "$$aref $$aref[] $$whoopsies[]"' , X::Undeclared , symbol => ' $whoopsies' ;
128
+ throws-like ' "@$aref @$aref[] @$whoopsies[]"' , X::Undeclared , symbol => ' $whoopsies' ;
129
+ throws-like ' "%$href %$href{} %$whoopsies{}"' , X::Undeclared , symbol => ' $whoopsies' ;
130
+ throws-like ' "&$cref &$cref() &$whoopsies()"' , X::Undeclared , symbol => ' $whoopsies' ;
131
+
132
+ # make sure existing objects don't fail
133
+
134
+ my @ arry = 42 ;
135
+ my % hash = : foo;
136
+ my & code = & exp ;
137
+
138
+ throws-like ' "$@arry $@arry[] $@whoopsies[]"' , X::Undeclared , symbol => ' @whoopsies' ;
139
+ throws-like ' "$%hash $%hash{} $%whoopsies{}"' , X::Undeclared , symbol => ' %whoopsies' ;
140
+ throws-like ' "$&code $&code() $&whoopsies()"' , X::Undeclared::Symbols ;
141
+
87
142
}
88
143
89
144
# vim: ft=perl6
0 commit comments