develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH t/op/local.t] correction

From:
Michael G Schwern
Date:
August 31, 2001 16:58
Subject:
[PATCH t/op/local.t] correction
Message ID:
20010831195802.D8039@blackrider
Ooopsie.  That op/local.t patch fails if you run it as:

    cd t;
    ./perl harness op/local.t

Here's the whole test patch again.


--- t/op/local.t	2001/08/31 23:20:39	1.1
+++ t/op/local.t	2001/08/31 23:55:53
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..71\n";
+print "1..78\n";
 
 sub foo {
     local($a, $b) = @_;
@@ -243,3 +243,39 @@
     print "not " if exists $x{c};
     print "ok 71\n"; 
 }
+
+
+# Temporary measure until the above tests are cleaned up.
+my $test = 72;
+sub ok {
+    my($ok, $name) = @_;
+
+    # You have to do it this way or VMS will get confused.
+    print $ok ? "ok $test - $name\n" : "not ok $test - $name\n";
+    
+    printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+    
+    $test++;
+    return $ok;
+}
+
+
+print "# Testing local chdir.\n";
+use File::Spec::Functions qw(updir);
+
+chdir(updir) unless -x 't';
+{
+    ok( local chdir("t"),   'local chdir() returns properly' );
+    ok( -r 'op',            'local chdir() works' );
+
+    ok( local chdir("op"),  '  still returning properly' );
+    ok( -r "local.t",       '  twice in the same block' );
+
+    {
+        ok( local chdir(updir),    '    returns right' );
+        ok( -r 'op',               '    in an inner block' );
+    }
+}
+ok( -r 't' && !-r 'local.t',  '  and the cwd restores itself' );


-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     Kwalitee Is Job One
Death follows me like a wee followey thing.
	-- Quakeman



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About