Fix bug #26910: hints were not propagated into (?{...})
[p5sagit/p5-mst-13.2.git] / t / lib / strict / subs
index ed4fe7a..4f0e621 100644 (file)
@@ -26,6 +26,15 @@ EXPECT
 
 # strict subs - error
 use strict 'subs' ;
+my @a = (1..2);
+my $b = xyz;
+EXPECT
+Bareword "xyz" not allowed while "strict subs" in use at - line 5.
+Execution of - aborted due to compilation errors.
+########
+
+# strict subs - error
+use strict 'subs' ;
 Fred ;
 EXPECT
 Bareword "Fred" not allowed while "strict subs" in use at - line 4.
@@ -317,3 +326,57 @@ Foo A 1
 Foo B 2
 Foo C 3
 Foo D 4
+########
+
+# Check that barewords on the RHS of a regex match are caught
+use strict;
+"" =~ foo;
+EXPECT
+Bareword "foo" not allowed while "strict subs" in use at - line 4.
+Execution of - aborted due to compilation errors.
+
+########
+
+# ID 20020703.002
+use strict;
+use warnings;
+my $abc = XYZ ? 1 : 0;
+print "$abc\n";
+EXPECT
+Bareword "XYZ" not allowed while "strict subs" in use at - line 5.
+Execution of - aborted due to compilation errors.
+########
+
+# [perl #10021]
+use strict;
+use warnings;
+print "" if BAREWORD;
+EXPECT
+Bareword "BAREWORD" not allowed while "strict subs" in use at - line 5.
+Execution of - aborted due to compilation errors.
+########
+# Ticket: 18927
+use strict 'subs';
+print 1..1, bad;
+EXPECT
+Bareword "bad" not allowed while "strict subs" in use at - line 3.
+Execution of - aborted due to compilation errors.
+########
+eval q{ use strict; no strict refs; };
+print $@;
+EXPECT
+Bareword "refs" not allowed while "strict subs" in use at (eval 1) line 1.
+########
+# [perl #25147] 
+use strict;
+print "" if BAREWORD;
+EXPECT
+Bareword "BAREWORD" not allowed while "strict subs" in use at - line 3.
+Execution of - aborted due to compilation errors.
+########
+# [perl #26910] hints not propagated into (?{...})
+use strict 'subs';
+qr/(?{my $x=foo})/;
+EXPECT
+Bareword "foo" not allowed while "strict subs" in use at (re_eval 1) line 1.
+Compilation failed in regexp at - line 3.