summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLarry Wall <larry@netlabs.com>1993-11-10 00:00:00 +0000
committerLarry Wall <larry@netlabs.com>1993-11-10 00:00:00 +0000
commit463ee0b2acbd047c27e8b5393cdd8398881824c5 (patch)
treeae17d9179fc861ae5fc5a86da9139631530cb6fe /t
parent93a17b20b6d176db3f04f51a63b0a781e5ffd11c (diff)
downloadperl-463ee0b2acbd047c27e8b5393cdd8398881824c5.tar.gz
perl 5.0 alpha 4
[editor's note: the sparc executables have not been included, and emacs backup files have been removed. This was reconstructed from a tarball found on the September 1994 InfoMagic CD; the date of this is approximate]
Diffstat (limited to 't')
-rwxr-xr-xt/comp/cmdopt.t18
-rwxr-xr-xt/comp/package.t10
-rwxr-xr-xt/op/dbm.t10
-rwxr-xr-xt/op/ord.t4
-rwxr-xr-xt/op/sort.t6
-rwxr-xr-xt/op/time.t2
-rwxr-xr-xt/op/write.t2
7 files changed, 29 insertions, 23 deletions
diff --git a/t/comp/cmdopt.t b/t/comp/cmdopt.t
index 1ee3581464..4d5c78a4cb 100755
--- a/t/comp/cmdopt.t
+++ b/t/comp/cmdopt.t
@@ -33,7 +33,7 @@ if (1 || $x) { print "ok 15\n";} else { print "not ok 15\n";}
if (0 || $x) { print "not ok 16\n";} else { print "ok 16\n";}
-# test the optimization of registers
+# test the optimization of variables
$x = 1;
if ($x) { print "ok 17\n";} else { print "not ok 17\n";}
@@ -55,18 +55,18 @@ if ($a !~ /a/) { print "not ok 24\n";} else { print "ok 24\n";}
$a = 'a';
$x = 1;
-if ($a eq 'a' && $x) { print "ok 25\n";} else { print "not ok 25\n";}
-if ($a ne 'a' && $x) { print "not ok 26\n";} else { print "ok 26\n";}
+if ($a eq 'a' and $x) { print "ok 25\n";} else { print "not ok 25\n";}
+if ($a ne 'a' and $x) { print "not ok 26\n";} else { print "ok 26\n";}
$x = '';
-if ($a eq 'a' && $x) { print "not ok 27\n";} else { print "ok 27\n";}
-if ($a ne 'a' && $x) { print "not ok 28\n";} else { print "ok 28\n";}
+if ($a eq 'a' and $x) { print "not ok 27\n";} else { print "ok 27\n";}
+if ($a ne 'a' and $x) { print "not ok 28\n";} else { print "ok 28\n";}
$x = 1;
-if ($a eq 'a' || $x) { print "ok 29\n";} else { print "not ok 29\n";}
-if ($a ne 'a' || $x) { print "ok 30\n";} else { print "not ok 30\n";}
+if ($a eq 'a' or $x) { print "ok 29\n";} else { print "not ok 29\n";}
+if ($a ne 'a' or $x) { print "ok 30\n";} else { print "not ok 30\n";}
$x = '';
-if ($a eq 'a' || $x) { print "ok 31\n";} else { print "not ok 31\n";}
-if ($a ne 'a' || $x) { print "not ok 32\n";} else { print "ok 32\n";}
+if ($a eq 'a' or $x) { print "ok 31\n";} else { print "not ok 31\n";}
+if ($a ne 'a' or $x) { print "not ok 32\n";} else { print "ok 32\n";}
$x = 1;
if ($a =~ /a/ && $x) { print "ok 33\n";} else { print "not ok 33\n";}
diff --git a/t/comp/package.t b/t/comp/package.t
index 5237011a62..456c0ffa4d 100755
--- a/t/comp/package.t
+++ b/t/comp/package.t
@@ -19,14 +19,16 @@ $ABC'dyick = 6;
$xyz = 2;
-$main = join(':', sort(keys _main));
-$XYZ = join(':', sort(keys _XYZ));
-$ABC = join(':', sort(keys _ABC));
+$main = join(':', sort(keys %::_main));
+$XYZ = join(':', sort(keys %::_XYZ));
+$ABC = join(':', sort(keys %::_ABC));
print $XYZ eq 'ABC:XYZ:bar:main:xyz' ? "ok 1\n" : "not ok 1 '$XYZ'\n";
-print $ABC eq 'blurfl:dyick' ? "ok 2\n" : "not ok 2\n";
+print $ABC eq 'blurfl:dyick' ? "ok 2\n" : "not ok 2 '$ABC'\n";
print $main'blurfl == 123 ? "ok 3\n" : "not ok 3\n";
+
package ABC;
+
print $blurfl == 5 ? "ok 4\n" : "not ok 4\n";
eval 'print $blurfl == 5 ? "ok 5\n" : "not ok 5\n";';
eval 'package main; print $blurfl == 123 ? "ok 6\n" : "not ok 6\n";';
diff --git a/t/op/dbm.t b/t/op/dbm.t
index f09ca4febf..a011169865 100755
--- a/t/op/dbm.t
+++ b/t/op/dbm.t
@@ -10,11 +10,13 @@ if (!-r '/usr/include/dbm.h' && !-r '/usr/include/ndbm.h'
print "1..12\n";
+init SDBM_File;
+
unlink <Op.dbmx.*>;
unlink Op.dbmx; # in case we're running gdbm
umask(0);
-print (dbmopen(h,'Op.dbmx',0640) ? "ok 1\n" : "not ok 1\n");
+print (tie(%h,SDBM_File,'Op.dbmx', 0x202, 0640) ? "ok 1\n" : "not ok 1\n");
$Dfile = "Op.dbmx.pag";
if (! -e $Dfile) {
@@ -24,7 +26,7 @@ if (! -e $Dfile) {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat($Dfile);
print (($mode & 0777) == 0640 ? "ok 2\n" : "not ok 2\n");
-while (($key,$value) = each(h)) {
+while (($key,$value) = each(%h)) {
$i++;
}
print (!$i ? "ok 3\n" : "not ok 3\n");
@@ -48,8 +50,8 @@ $h{'i'} = 'I';
$h{'goner2'} = 'snork';
delete $h{'goner2'};
-dbmclose(h);
-print (dbmopen(h,'Op.dbmx',0640) ? "ok 4\n" : "not ok 4\n");
+untie(%h);
+print (tie(%h,SDBM_File,'Op.dbmx', 0x2, 0640) ? "ok 4\n" : "not ok 4\n");
$h{'j'} = 'J';
$h{'k'} = 'K';
diff --git a/t/op/ord.t b/t/op/ord.t
index 67b8e24686..37128382d8 100755
--- a/t/op/ord.t
+++ b/t/op/ord.t
@@ -2,7 +2,7 @@
# $RCSfile: ord.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:09 $
-print "1..2\n";
+print "1..3\n";
# compile time evaluation
@@ -12,3 +12,5 @@ if (ord('A') == 65) {print "ok 1\n";} else {print "not ok 1\n";}
$x = 'ABC';
if (ord($x) == 65) {print "ok 2\n";} else {print "not ok 2\n";}
+
+if (chr 65 == A) {print "ok 3\n";} else {print "not ok 3\n";}
diff --git a/t/op/sort.t b/t/op/sort.t
index bf7a31759c..56a0fd3e92 100755
--- a/t/op/sort.t
+++ b/t/op/sort.t
@@ -4,7 +4,7 @@
print "1..10\n";
-sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
+sub backwards { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
@harry = ('dog','cat','x','Cain','Abel');
@george = ('gone','chased','yz','Punished','Axed');
@@ -12,7 +12,7 @@ sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
$x = join('', sort @harry);
print ($x eq 'AbelCaincatdogx' ? "ok 1\n" : "not ok 1\n");
-$x = join('', sort reverse @harry);
+$x = join('', sort backwards @harry);
print ($x eq 'xdogcatCainAbel' ? "ok 2\n" : "not ok 2\n");
$x = join('', sort @george, 'to', @harry);
@@ -42,7 +42,7 @@ print ("@b" eq "4 3 2 1" ? "ok 8\n" : "not ok 8 (@b)\n");
@b = sort {$a <=> $b;} @a;
print ("@b" eq "2 3 4 10" ? "ok 9\n" : "not ok 9 (@b)\n");
-$sub = 'reverse';
+$sub = 'backwards';
$x = join('', sort $sub @harry);
print ($x eq 'xdogcatCainAbel' ? "ok 10\n" : "not ok 10\n");
diff --git a/t/op/time.t b/t/op/time.t
index 347592dab4..6d23832dfa 100755
--- a/t/op/time.t
+++ b/t/op/time.t
@@ -8,7 +8,7 @@ print "1..5\n";
$beg = time;
-while (($now = time) == $beg) {}
+while (($now = time) == $beg) { sleep 1 }
if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}
diff --git a/t/op/write.t b/t/op/write.t
index 35aba42eaa..eb00d81b59 100755
--- a/t/op/write.t
+++ b/t/op/write.t
@@ -57,7 +57,7 @@ now @<<the@>>>> for all@|||||men to come @<<<<
'i' . 's', "time\n", $good, 'to'
.
-open(OUT2, '>Op.write.tmp') || die "Can't create Op.write.tmp";
+open OUT2, '>Op.write.tmp' or die "Can't create Op.write.tmp";
$fox = 'foxiness';
$good = 'good';