aboutsummaryrefslogtreecommitdiff
path: root/contrib/perl5/t/pragma/strict-subs
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2000-06-25 11:04:01 +0000
committerMark Murray <markm@FreeBSD.org>2000-06-25 11:04:01 +0000
commit120a02d4f3990e59fba1df18a155ff7233b4d827 (patch)
tree52ba93338b13aefd02a0055304a9eccfa0e049f5 /contrib/perl5/t/pragma/strict-subs
parent7c312e6b6a7b1f9412f10365baf3c5eca8fa5649 (diff)
Vendor import of Perl 5.006
Notes
Notes: svn path=/vendor/perl5/dist/; revision=62076
Diffstat (limited to 'contrib/perl5/t/pragma/strict-subs')
-rw-r--r--contrib/perl5/t/pragma/strict-subs40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/perl5/t/pragma/strict-subs b/contrib/perl5/t/pragma/strict-subs
index 61ec286eb6db..ed4fe7a44393 100644
--- a/contrib/perl5/t/pragma/strict-subs
+++ b/contrib/perl5/t/pragma/strict-subs
@@ -33,6 +33,24 @@ Execution of - aborted due to compilation errors.
########
# strict subs - error
+use strict 'subs' ;
+my @a = (A..Z);
+EXPECT
+Bareword "Z" not allowed while "strict subs" in use at - line 4.
+Bareword "A" not allowed while "strict subs" in use at - line 4.
+Execution of - aborted due to compilation errors.
+########
+
+# strict subs - error
+use strict 'subs' ;
+my $a = (B..Y);
+EXPECT
+Bareword "Y" not allowed while "strict subs" in use at - line 4.
+Bareword "B" not allowed while "strict subs" in use at - line 4.
+Execution of - aborted due to compilation errors.
+########
+
+# strict subs - error
use strict ;
Fred ;
EXPECT
@@ -277,3 +295,25 @@ my $a = Fred ;
EXPECT
Bareword "Fred" not allowed while "strict subs" in use at - line 8.
Execution of - aborted due to compilation errors.
+########
+
+# see if Foo->Bar(...) etc work under strictures
+use strict;
+package Foo; sub Bar { print "@_\n" }
+Foo->Bar('a',1);
+Bar Foo ('b',2);
+Foo->Bar(qw/c 3/);
+Bar Foo (qw/d 4/);
+Foo::->Bar('A',1);
+Bar Foo:: ('B',2);
+Foo::->Bar(qw/C 3/);
+Bar Foo:: (qw/D 4/);
+EXPECT
+Foo a 1
+Foo b 2
+Foo c 3
+Foo d 4
+Foo A 1
+Foo B 2
+Foo C 3
+Foo D 4