summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-09-20 07:01:26 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-09-20 07:01:26 +0000
commit30adffae6205ce03b6a039dea7bf52af0341657f (patch)
treeeb8855debf79b8cabc7b2ee5b8ed1e8364ce9da4 /t
parent52073c8cfba97ec38e542aa95d3739cd6d9faa0b (diff)
parent17b275ff7f254c13ec0fa07c81e929826b830a85 (diff)
downloadperl-30adffae6205ce03b6a039dea7bf52af0341657f.tar.gz
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@4201
Diffstat (limited to 't')
-rwxr-xr-xt/op/args.t54
-rw-r--r--t/pragma/strict-refs2
-rw-r--r--t/pragma/strict-vars16
3 files changed, 72 insertions, 0 deletions
diff --git a/t/op/args.t b/t/op/args.t
new file mode 100755
index 0000000000..48bf5afec0
--- /dev/null
+++ b/t/op/args.t
@@ -0,0 +1,54 @@
+#!./perl
+
+print "1..8\n";
+
+# test various operations on @_
+
+my $ord = 0;
+sub new1 { bless \@_ }
+{
+ my $x = new1("x");
+ my $y = new1("y");
+ ++$ord;
+ print "# got [@$y], expected [y]\nnot " unless "@$y" eq "y";
+ print "ok $ord\n";
+ ++$ord;
+ print "# got [@$x], expected [x]\nnot " unless "@$x" eq "x";
+ print "ok $ord\n";
+}
+
+sub new2 { splice @_, 0, 0, "a", "b", "c"; return \@_ }
+{
+ my $x = new2("x");
+ my $y = new2("y");
+ ++$ord;
+ print "# got [@$x], expected [a b c x]\nnot " unless "@$x" eq "a b c x";
+ print "ok $ord\n";
+ ++$ord;
+ print "# got [@$y], expected [a b c y]\nnot " unless "@$y" eq "a b c y";
+ print "ok $ord\n";
+}
+
+sub new3 { goto &new1 }
+{
+ my $x = new3("x");
+ my $y = new3("y");
+ ++$ord;
+ print "# got [@$y], expected [y]\nnot " unless "@$y" eq "y";
+ print "ok $ord\n";
+ ++$ord;
+ print "# got [@$x], expected [x]\nnot " unless "@$x" eq "x";
+ print "ok $ord\n";
+}
+
+sub new4 { goto &new2 }
+{
+ my $x = new4("x");
+ my $y = new4("y");
+ ++$ord;
+ print "# got [@$x], expected [a b c x]\nnot " unless "@$x" eq "a b c x";
+ print "ok $ord\n";
+ ++$ord;
+ print "# got [@$y], expected [a b c y]\nnot " unless "@$y" eq "a b c y";
+ print "ok $ord\n";
+}
diff --git a/t/pragma/strict-refs b/t/pragma/strict-refs
index 7bf1556e10..10599b0bb2 100644
--- a/t/pragma/strict-refs
+++ b/t/pragma/strict-refs
@@ -196,6 +196,7 @@ ${"Fred"} ;
require "./abc";
EXPECT
Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at ./abc line 2.
+Compilation failed in require at - line 2.
########
--FILE-- abc.pm
@@ -207,6 +208,7 @@ my $a = ${"Fred"} ;
use abc;
EXPECT
Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at abc.pm line 2.
+Compilation failed in require at - line 2.
BEGIN failed--compilation aborted at - line 2.
########
diff --git a/t/pragma/strict-vars b/t/pragma/strict-vars
index 42107fa8e1..3e3e0e3a35 100644
--- a/t/pragma/strict-vars
+++ b/t/pragma/strict-vars
@@ -165,6 +165,7 @@ print STDERR $@;
$joe = 1 ;
EXPECT
Global symbol "$joe" requires explicit package name at - line 5.
+Global symbol "$joe" requires explicit package name at - line 8.
Execution of - aborted due to compilation errors.
########
@@ -221,3 +222,18 @@ $joe = 1 ;
EXPECT
Global symbol "$joe" requires explicit package name at - line 8.
Execution of - aborted due to compilation errors.
+########
+
+# Check if multiple evals produce same errors
+use strict 'vars';
+my $ret = eval q{ print $x; };
+print $@;
+print "ok 1\n" unless defined $ret;
+$ret = eval q{ print $x; };
+print $@;
+print "ok 2\n" unless defined $ret;
+EXPECT
+Global symbol "$x" requires explicit package name at (eval 1) line 1.
+ok 1
+Global symbol "$x" requires explicit package name at (eval 2) line 1.
+ok 2