summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLarry Wall <larry@netlabs.com>1993-10-10 00:00:00 +0000
committerLarry Wall <larry@netlabs.com>1993-10-10 00:00:00 +0000
commit93a17b20b6d176db3f04f51a63b0a781e5ffd11c (patch)
tree764149b1d480d5236d4d62b3228bd57f53a71042 /t
parent79072805bf63abe5b5978b5928ab00d360ea3e7f (diff)
downloadperl-93a17b20b6d176db3f04f51a63b0a781e5ffd11c.tar.gz
perl 5.0 alpha 3
[editor's note: the sparc executables have not been included, and emacs backup files have been removed]
Diffstat (limited to 't')
-rwxr-xr-xt/cmd/subval.t32
-rwxr-xr-xt/foo8
-rwxr-xr-xt/op/local.t4
-rwxr-xr-xt/op/my.t46
-rwxr-xr-xt/op/ref.t4
5 files changed, 66 insertions, 28 deletions
diff --git a/t/cmd/subval.t b/t/cmd/subval.t
index 90345f2c65..3c1ffb89ea 100755
--- a/t/cmd/subval.t
+++ b/t/cmd/subval.t
@@ -35,32 +35,32 @@ sub foo6 {
print "1..34\n";
-if (do foo1(0) eq '0') {print "ok 1\n";} else {print "not ok 1 $foo\n";}
-if (do foo1(1) eq 'true2') {print "ok 2\n";} else {print "not ok 2\n";}
-if (do foo2(0) eq 'true3') {print "ok 3\n";} else {print "not ok 3\n";}
-if (do foo2(1) eq 'true2') {print "ok 4\n";} else {print "not ok 4\n";}
+if (&foo1(0) eq '0') {print "ok 1\n";} else {print "not ok 1 $foo\n";}
+if (&foo1(1) eq 'true2') {print "ok 2\n";} else {print "not ok 2\n";}
+if (&foo2(0) eq 'true3') {print "ok 3\n";} else {print "not ok 3\n";}
+if (&foo2(1) eq 'true2') {print "ok 4\n";} else {print "not ok 4\n";}
-if (do foo3(0) eq 'true2') {print "ok 5\n";} else {print "not ok 5\n";}
-if (do foo3(1) eq '1') {print "ok 6\n";} else {print "not ok 6\n";}
-if (do foo4(0) eq 'true2') {print "ok 7\n";} else {print "not ok 7\n";}
-if (do foo4(1) eq 'true3') {print "ok 8\n";} else {print "not ok 8\n";}
+if (&foo3(0) eq 'true2') {print "ok 5\n";} else {print "not ok 5\n";}
+if (&foo3(1) eq '1') {print "ok 6\n";} else {print "not ok 6\n";}
+if (&foo4(0) eq 'true2') {print "ok 7\n";} else {print "not ok 7\n";}
+if (&foo4(1) eq 'true3') {print "ok 8\n";} else {print "not ok 8\n";}
-if (do foo5(0) eq '0') {print "ok 9\n";} else {print "not ok 9\n";}
-if (do foo5(1) eq 'true2') {print "ok 10\n";} else {print "not ok 10\n";}
-if (do foo6(0) eq 'true2') {print "ok 11\n";} else {print "not ok 11\n";}
-if (do foo6(1) eq '1') {print "ok 12\n";} else {print "not ok 12 $x\n";}
+if (&foo5(0) eq '0') {print "ok 9\n";} else {print "not ok 9\n";}
+if (&foo5(1) eq 'true2') {print "ok 10\n";} else {print "not ok 10\n";}
+if (&foo6(0) eq 'true2') {print "ok 11\n";} else {print "not ok 11\n";}
+if (&foo6(1) eq '1') {print "ok 12\n";} else {print "not ok 12 $x\n";}
# Now test to see that recursion works using a Fibonacci number generator
sub fib {
- local($arg) = @_;
- local($foo);
+ my($arg) = @_;
+ my($foo);
$level++;
if ($arg <= 2) {
$foo = 1;
}
else {
- $foo = do fib($arg-1) + do fib($arg-2);
+ $foo = &fib($arg-1) + &fib($arg-2);
}
$level--;
$foo;
@@ -70,7 +70,7 @@ sub fib {
for ($i = 1; $i <= 10; $i++) {
$foo = $i + 12;
- if (do fib($i) == $good[$i]) {
+ if (&fib($i) == $good[$i]) {
print "ok $foo\n";
}
else {
diff --git a/t/foo b/t/foo
deleted file mode 100755
index 9070e7874c..0000000000
--- a/t/foo
+++ /dev/null
@@ -1,8 +0,0 @@
-#!./perl
-
-$_ = 'aaabbbccc';
-if (/(a+b+c+)/ && $1 eq 'aaabbbccc') {
- print "ok 14\n";
-} else {
- print "not ok 14\n";
-}
diff --git a/t/op/local.t b/t/op/local.t
index 5f007fd4f6..043201072d 100755
--- a/t/op/local.t
+++ b/t/op/local.t
@@ -19,7 +19,7 @@ $b = "ok 6\n";
$c = "ok 7\n";
$d = "ok 8\n";
-print do foo("ok 1\n","ok 2\n");
+print &foo("ok 1\n","ok 2\n");
print $a,$b,$c,$d,$x,$y;
@@ -40,6 +40,6 @@ $a = "ok 15\n";
@c = "ok 17\n";
$d{''} = "ok 18\n";
-print do foo2("ok 11\n","ok 12\n");
+print &foo2("ok 11\n","ok 12\n");
print $a,@b,@c,%d,$x,$y;
diff --git a/t/op/my.t b/t/op/my.t
new file mode 100755
index 0000000000..4ce020f206
--- /dev/null
+++ b/t/op/my.t
@@ -0,0 +1,46 @@
+#!./perl
+
+# $RCSfile: local.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:04 $
+
+print "1..20\n";
+
+sub foo {
+ my($a, $b) = @_;
+ my $c;
+ my $d;
+ $c = "ok 3\n";
+ $d = "ok 4\n";
+ { my($a,$c) = ("ok 9\n", "ok 10\n"); ($x, $y) = ($a, $c); }
+ print $a, $b;
+ $c . $d;
+}
+
+$a = "ok 5\n";
+$b = "ok 6\n";
+$c = "ok 7\n";
+$d = "ok 8\n";
+
+print &foo("ok 1\n","ok 2\n");
+
+print $a,$b,$c,$d,$x,$y;
+
+# same thing, only with arrays and associative arrays
+
+sub foo2 {
+ my($a, @b) = @_;
+ my(@c, %d);
+ @c = "ok 13\n";
+ $d{''} = "ok 14\n";
+ { my($a,@c) = ("ok 19\n", "ok 20\n"); ($x, $y) = ($a, @c); }
+ print $a, @b;
+ $c[0] . $d{''};
+}
+
+$a = "ok 15\n";
+@b = "ok 16\n";
+@c = "ok 17\n";
+$d{''} = "ok 18\n";
+
+print &foo2("ok 11\n","ok 12\n");
+
+print $a,@b,@c,%d,$x,$y;
diff --git a/t/op/ref.t b/t/op/ref.t
index cace1e14bd..b0619cbc2c 100755
--- a/t/op/ref.t
+++ b/t/op/ref.t
@@ -81,14 +81,14 @@ $refref = \%whatever;
$refref->{"key"} = $ref;
print $refref->{"key"}->[2]->[0] == 3 ? "ok 20\n" : "not ok 20\n";
-# Test to see if anonymous subarrays sprint into existence.
+# Test to see if anonymous subarrays spring into existence.
$spring[5]->[0] = 123;
$spring[5]->[1] = 456;
push(@{$spring[5]}, 789);
print join(':',@{$spring[5]}) eq "123:456:789" ? "ok 21\n" : "not ok 21\n";
-# Test to see if anonymous subhashes sprint into existence.
+# Test to see if anonymous subhashes spring into existence.
@{$spring2{"foo"}} = (1,2,3);
$spring2{"foo"}->[3] = 4;