X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Fstrict%2Fsubs;h=4f0e6215f717bb1665567ae71eaa4c4a8e57eb2e;hb=35d904946636411814f392bec019cad90a357c0a;hp=ed4fe7a44393d36a7f5dcefdf73085b75e2b2f6b;hpb=8a6cb2cbf33b292e9c5c2689417fb9f525f67df2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/strict/subs b/t/lib/strict/subs index ed4fe7a..4f0e621 100644 --- a/t/lib/strict/subs +++ b/t/lib/strict/subs @@ -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.