The patch at the end of this message fixes several problems with the 
japh test, including getting it to pass arguments to its own skip 
function in the expected order, getting it to increment the test 
counter when it skips multiple tests, getting it to not insert extra 
newlines in the output stream when it skips tests, getting it to 
actually skip the tests that it has marked in the data with the 
SKIP_OS tag, and dodging a couple of uninitialized value warnings in 
the END blocks.  It now runs cleanly on VMS and will probably be a 
bit better on some other OS's as well.

I'm sorry to pick on Abigail, who is hardly the outrider in cryptic 
test descriptions, but the lone comment at the beginning of the test 
is less than helpful:

#
# Tests derived from Japhs.
#

I had several years intermittent exposure to Perl before I ever heard 
what a japh was, and I don't learn anything from the comment about 
why they are something to derive tests from.  Would two or three 
sentences at the top of each test script describing the what, why, 
and how of the tests included there be a reasonable minimum?  Does, 
for example, "# tr.t" tell me anything about what t/op/tr.t is 
testing?  When writing a test please assume that the person who 
encounters the first failure will never have heard of the operator or 
module you are testing.  If that person is me, your assumption will 
be correct about half the time.  (end of midnight diatribe)

--- t/japh/abigail.t;-0 Mon Apr 15 17:58:54 2002
+++ t/japh/abigail.t    Tue Apr 23 00:44:41 2002
@@ -21,9 +21,9 @@
 #
 sub skip {
     my $why  = shift;
-    my $test = curr_test;
     my $n    = @_ ? shift : 1;
     for (1..$n) {
+        my $test = curr_test;
         print STDOUT "ok $test # skip: $why\n";
         next_test;
     }
@@ -80,7 +80,7 @@
     if ($^O eq 'MSWin32' ||
         $^O eq 'NetWare' ||
         $^O eq 'VMS') {
-            skip 3, "Your platform quotes differently.\n";
+            skip "Your platform quotes differently.", 3;
             last;
     }
 
@@ -108,7 +108,7 @@
     if ($^O eq 'MSWin32' ||
         $^O eq 'NetWare' ||
         $^O eq 'VMS') {
-            skip 1, "Your platform quotes differently.\n";
+            skip "Your platform quotes differently.", 1;
             last;
     }
     is (runperl (switches => [qw /-sweprint --/,
@@ -121,7 +121,7 @@
 {
     my $datafile = "datatmp000";
     1 while -f ++ $datafile;
-    END {unlink_all $datafile}
+    END {1 while unlink $datafile}
 
     open  MY_DATA, "> $datafile" or die "Failed to open $datafile: $!";
     print MY_DATA  << "    --";
@@ -174,10 +174,12 @@
             next;
         }
 
-        if (@{$program -> {SKIP_OS}} &&
-            grep {$^O eq $_} @{$program -> {SKIP_OS}}) {
-            skip "Your OS uses different quoting.";
-            next;
+        if (@{$program -> {SKIP_OS}}) {
+            chomp(@{$program -> {SKIP_OS}});
+            if (grep {$^O eq $_} @{$program -> {SKIP_OS}}) {
+                skip "Your OS uses different quoting.";
+                next;
+            }
         }
 
         map {s/\$datafile/$datafile/} @{$program -> {ARGS}};
@@ -199,7 +201,12 @@
 {
     my $progfile = "progtmp000";
     1 while -f ++ $progfile;
-    END {unlink_all $progfile}
+    END {1 while unlink $progfile}
+
+    if ($^O eq 'VMS') {
+        skip "Abusing \$0 is not portable.", 4;
+        last;
+    }
 
     my @programs = (<< '    --', << '    --');
 #!./perl               --    # No trailing newline after the last line!
[end of patch]

Reply via email to