Test that __PACKAGE__ is read-only
authorFather Chrysostomos <sprout@cpan.org>
Sun, 4 Aug 2013 06:08:42 +0000 (23:08 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 4 Aug 2013 06:41:21 +0000 (23:41 -0700)
I.e., test that this bug is fixed:

$ perl -e 'for(1..10){for(__PACKAGE__){warn $_; $_++}}'
main at -e line 1.
maio at -e line 1.
maip at -e line 1.
maiq at -e line 1.
mair at -e line 1.
mais at -e line 1.
mait at -e line 1.
maiu at -e line 1.
maiv at -e line 1.
maiw at -e line 1.

for my$p(__PACKAGE__){$p++for+1..55664
,;!print"Just another \u$p hacker,\n"}

t/comp/parser.t

index 38a7dc8..5f0d407 100644 (file)
@@ -8,7 +8,7 @@ BEGIN {
     chdir 't';
 }
 
-print "1..156\n";
+print "1..157\n";
 
 sub failed {
     my ($got, $expected, $name) = @_;
@@ -477,6 +477,11 @@ $test
     write();
 }
 
+for(__PACKAGE__) {
+    eval '$_=42';
+    is $_, 'main', '__PACKAGE__ is read-only';
+}
+
 # Add new tests HERE (above this line)
 
 # bug #74022: Loop on characters in \p{OtherIDContinue}