summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-11-11 03:50:16 +0000
committerLarry Wall <lwall@netlabs.com>1991-11-11 03:50:16 +0000
commit988174c19bcf26f6c6e0551f1dfbba78203bc2ce (patch)
tree7918e82dffc7e46c520ab9fafb727f369b32e8d9 /t
parent55204971972392ce5a252fbbd6d78b1c48ed70e3 (diff)
downloadperl-988174c19bcf26f6c6e0551f1dfbba78203bc2ce.tar.gz
perl 4.0 patch 19: (combined patch)
Ok, here's the cleanup patch I suggested you wait for. Have at it... Subject: added little-endian pack/unpack options This is the only enhancement in this patch, but it seemed unlikely to bust anything else, and added functionality that it was very difficult to do any other way. Compliments of David W. Sanderson. Subject: op/regexp.t failed from missing arg to bcmp() Subject: study was busted by 4.018 Subject: sort $subname was busted by changes in 4.018 Subject: default arg for shift was wrong after first subroutine definition Things that broke in 4.018. Shame on me. Subject: do {$foo ne "bar";} returned wrong value A bug of long standing. How come nobody saw this one? Or if you did, why didn't you report it before now? Or if you did, why did I ignore you? :-) Subject: some machines need -lsocket before -lnsl Subject: some earlier patches weren't propagated to alternate 286 code Subject: compile in the x2p directory couldn't find cppstdin Subject: more hints for aix, isc, hp, sco, uts Subject: installperl no longer updates unchanged library files Subject: uts wrongly defines S_ISDIR() et al Subject: too many preprocessors can't expand a macro right in #if The usual pastiche of portability kludges. Subject: deleted some unused functions from usersub.c And fixed the spelling of John Macdonald's name, and included his suggested workaround for a certain vendor's stdio bug... Subject: added readdir test Subject: made op/groups.t more reliable Subject: added test for sort $subname to op/sort.t Subject: added some hacks to op/stat.t for weird filesystem architectures Improvements (hopefully) to the regression tests.
Diffstat (limited to 't')
-rw-r--r--t/op/groups.t35
-rw-r--r--t/op/readdir.t20
-rw-r--r--t/op/sort.t9
-rw-r--r--t/op/stat.t7
4 files changed, 61 insertions, 10 deletions
diff --git a/t/op/groups.t b/t/op/groups.t
index f8cb4cad58..e1520cc3d6 100644
--- a/t/op/groups.t
+++ b/t/op/groups.t
@@ -5,7 +5,13 @@ if (! -x '/usr/ucb/groups') {
exit 0;
}
-print "1..1\n";
+print "1..2\n";
+
+$pwgid = $( + 0;
+($pwgnam) = getgrgid($pwgid);
+@basegroup{$pwgid,$pwgnam} = (1,1);
+
+$seen{$pwgid}++;
for (split(' ', $()) {
next if $seen{$_}++;
@@ -17,8 +23,25 @@ for (split(' ', $()) {
push(@gr, $_);
}
}
-$gr1 = join(' ',sort @gr);
-$gr2 = join(' ', sort split(' ',`/usr/ucb/groups`));
-#print "gr1 is <$gr1>\n";
-#print "gr2 is <$gr2>\n";
-print +($gr1 eq $gr2) ? "ok 1\n" : "not ok 1\n";
+
+$gr1 = join(' ', sort @gr);
+
+$gr2 = join(' ', grep(!$basegroup{$_}, sort split(' ',`/usr/ucb/groups`)));
+
+if ($gr1 eq $gr2) {
+ print "ok 1\n";
+}
+else {
+ print "#gr1 is <$gr1>\n";
+ print "#gr2 is <$gr2>\n";
+ print "not ok 1\n";
+}
+
+# multiple 0's indicate GROUPSTYPE is currently long but should be short
+
+if ($pwgid == 0 || $seen{0} < 2) {
+ print "ok 2\n";
+}
+else {
+ print "not ok 2 (groupstype should be type short, not long)\n";
+}
diff --git a/t/op/readdir.t b/t/op/readdir.t
new file mode 100644
index 0000000000..8125bd4190
--- /dev/null
+++ b/t/op/readdir.t
@@ -0,0 +1,20 @@
+#!./perl
+
+eval 'opendir(NOSUCH, "no/such/directory");';
+if ($@) { print "1..0\n"; exit; }
+
+print "1..3\n";
+
+if (opendir(OP, "op")) { print "ok 1\n"; } else { print "not ok 1\n"; }
+@D = grep(/^[^\.]/, readdir(OP));
+closedir(OP);
+
+if (@D > 20 && @D < 100) { print "ok 2\n"; } else { print "not ok 2\n"; }
+
+@R = sort @D;
+@G = <op/*>;
+while (@R && @G && "op/".$R[0] eq $G[0]) {
+ shift(@R);
+ shift(@G);
+}
+if (@R == 0 && @G == 0) { print "ok 3\n"; } else { print "not ok 3\n"; }
diff --git a/t/op/sort.t b/t/op/sort.t
index 73a394421c..658a5bd1bc 100644
--- a/t/op/sort.t
+++ b/t/op/sort.t
@@ -1,8 +1,8 @@
#!./perl
-# $RCSfile: sort.t,v $$Revision: 4.0.1.1 $$Date: 91/11/05 18:43:47 $
+# $RCSfile: sort.t,v $$Revision: 4.0.1.2 $$Date: 91/11/11 16:43:47 $
-print "1..9\n";
+print "1..10\n";
sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
@@ -41,3 +41,8 @@ print ("@b" eq "4 3 2 1" ? "ok 8\n" : "not ok 8 (@b)\n");
@a = (10,2,3,4);
@b = sort {$a <=> $b;} @a;
print ("@b" eq "2 3 4 10" ? "ok 9\n" : "not ok 9 (@b)\n");
+
+$sub = 'reverse';
+$x = join('', sort $sub @harry);
+print ($x eq 'xdogcatCainAbel' ? "ok 10\n" : "not ok 10\n");
+
diff --git a/t/op/stat.t b/t/op/stat.t
index 1d1b22cac8..78b97dc191 100644
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -1,6 +1,6 @@
#!./perl
-# $RCSfile: stat.t,v $$Revision: 4.0.1.2 $$Date: 91/11/05 18:44:44 $
+# $RCSfile: stat.t,v $$Revision: 4.0.1.3 $$Date: 91/11/11 16:44:49 $
print "1..56\n";
@@ -11,6 +11,8 @@ $DEV = `ls -l /dev`;
unlink "Op.stat.tmp";
open(FOO, ">Op.stat.tmp");
+$junk = `ls Op.stat.tmp`; # hack to make Apollo update link count
+
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat(FOO);
if ($nlink == 1) {print "ok 1\n";} else {print "not ok 1\n";}
@@ -35,7 +37,8 @@ else {
}
print "#4 :$mtime: != :$ctime:\n";
-`cp /dev/null Op.stat.tmp`;
+`rm -f Op.stat.tmp`;
+`touch Op.stat.tmp`;
if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
if (! -s 'Op.stat.tmp') {print "ok 6\n";} else {print "not ok 6\n";}