Change 25407 by [EMAIL PROTECTED] on 2005/09/13 21:31:42

        Integrate:
        [ 24376]
        Convert to test.pl
        
        [ 24782]
        Convert op/array.t to test.pl
        
        [ 25054]
        Convert bless.t to test.pl
        
        [ 25202]
        Subject: [PATCH] Convert t/op/vec.t to test.pl
        From: Steve Peters <[EMAIL PROTECTED]>
        Date: Wed, 20 Jul 2005 08:06:38 -0500
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/maint-5.8/perl/t/op/array.t#4 integrate
... //depot/maint-5.8/perl/t/op/bless.t#2 integrate
... //depot/maint-5.8/perl/t/op/mkdir.t#5 integrate
... //depot/maint-5.8/perl/t/op/vec.t#3 integrate

Differences ...

==== //depot/maint-5.8/perl/t/op/array.t#4 (xtext) ====
Index: perl/t/op/array.t
--- perl/t/op/array.t#3~22982~  Wed Jun 23 06:22:41 2004
+++ perl/t/op/array.t   Tue Sep 13 14:31:42 2005
@@ -2,154 +2,145 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    @INC = '../lib';
+    @INC = '.', '../lib';
 }
 
-print "1..82\n";
+require 'test.pl';
+
+plan (85);
 
 #
 # @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them
 #
 
 @ary = (1,2,3,4,5);
-if (join('',@ary) eq '12345') {print "ok 1\n";} else {print "not ok 1\n";}
+is(join('',@ary), '12345');
 
 $tmp = $ary[$#ary]; --$#ary;
-if ($tmp == 5) {print "ok 2\n";} else {print "not ok 2\n";}
-if ($#ary == 3) {print "ok 3\n";} else {print "not ok 3\n";}
-if (join('',@ary) eq '1234') {print "ok 4\n";} else {print "not ok 4\n";}
+is($tmp, 5);
+is($#ary, 3);
+is(join('',@ary), '1234');
 
 $[ = 1;
 @ary = (1,2,3,4,5);
-if (join('',@ary) eq '12345') {print "ok 5\n";} else {print "not ok 5\n";}
+is(join('',@ary), '12345');
 
 $tmp = $ary[$#ary]; --$#ary;
-if ($tmp == 5) {print "ok 6\n";} else {print "not ok 6\n";}
-if ($#ary == 4) {print "ok 7\n";} else {print "not ok 7\n";}
-if (join('',@ary) eq '1234') {print "ok 8\n";} else {print "not ok 8\n";}
+is($tmp, 5);
+# Must do == here beacuse $[ isn't 0
+ok($#ary == 4);
+is(join('',@ary), '1234');
 
-if ($ary[5] eq '') {print "ok 9\n";} else {print "not ok 9\n";}
+is($ary[5], undef);
 
 $#ary += 1;    # see if element 5 gone for good
-if ($#ary == 5) {print "ok 10\n";} else {print "not ok 10\n";}
-if (defined $ary[5]) {print "not ok 11\n";} else {print "ok 11\n";}
+ok($#ary == 5);
+ok(!defined $ary[5]);
 
 $[ = 0;
 @foo = ();
 $r = join(',', $#foo, @foo);
-if ($r eq "-1") {print "ok 12\n";} else {print "not ok 12 $r\n";}
+is($r, "-1");
 $foo[0] = '0';
 $r = join(',', $#foo, @foo);
-if ($r eq "0,0") {print "ok 13\n";} else {print "not ok 13 $r\n";}
+is($r, "0,0");
 $foo[2] = '2';
 $r = join(',', $#foo, @foo);
-if ($r eq "2,0,,2") {print "ok 14\n";} else {print "not ok 14 $r\n";}
+is($r, "2,0,,2");
 @bar = ();
 $bar[0] = '0';
 $bar[1] = '1';
 $r = join(',', $#bar, @bar);
-if ($r eq "1,0,1") {print "ok 15\n";} else {print "not ok 15 $r\n";}
+is($r, "1,0,1");
 @bar = ();
 $r = join(',', $#bar, @bar);
-if ($r eq "-1") {print "ok 16\n";} else {print "not ok 16 $r\n";}
+is($r, "-1");
 $bar[0] = '0';
 $r = join(',', $#bar, @bar);
-if ($r eq "0,0") {print "ok 17\n";} else {print "not ok 17 $r\n";}
+is($r, "0,0");
 $bar[2] = '2';
 $r = join(',', $#bar, @bar);
-if ($r eq "2,0,,2") {print "ok 18\n";} else {print "not ok 18 $r\n";}
+is($r, "2,0,,2");
 reset 'b';
 @bar = ();
 $bar[0] = '0';
 $r = join(',', $#bar, @bar);
-if ($r eq "0,0") {print "ok 19\n";} else {print "not ok 19 $r\n";}
+is($r, "0,0");
 $bar[2] = '2';
 $r = join(',', $#bar, @bar);
-if ($r eq "2,0,,2") {print "ok 20\n";} else {print "not ok 20 $r\n";}
+is($r, "2,0,,2");
 
 $foo = 'now is the time';
-if (($F1,$F2,$Etc) = ($foo =~ /^(\S+)\s+(\S+)\s*(.*)/)) {
-    if ($F1 eq 'now' && $F2 eq 'is' && $Etc eq 'the time') {
-       print "ok 21\n";
-    }
-    else {
-       print "not ok 21\n";
-    }
-}
-else {
-    print "not ok 21\n";
-}
+ok(scalar (($F1,$F2,$Etc) = ($foo =~ /^(\S+)\s+(\S+)\s*(.*)/)));
+is($F1, 'now');
+is($F2, 'is');
+is($Etc, 'the time');
 
 $foo = 'lskjdf';
-if ($cnt = (($F1,$F2,$Etc) = ($foo =~ /^(\S+)\s+(\S+)\s*(.*)/))) {
-    print "not ok 22 $cnt $F1:$F2:$Etc\n";
-}
-else {
-    print "ok 22\n";
-}
+ok(!($cnt = (($F1,$F2,$Etc) = ($foo =~ /^(\S+)\s+(\S+)\s*(.*)/))))
+   or diag("$cnt $F1:$F2:$Etc");
 
 %foo = ('blurfl','dyick','foo','bar','etc.','etc.');
 %bar = %foo;
-print $bar{'foo'} eq 'bar' ? "ok 23\n" : "not ok 23\n";
+is($bar{'foo'}, 'bar');
 %bar = ();
-print $bar{'foo'} eq '' ? "ok 24\n" : "not ok 24\n";
+is($bar{'foo'}, undef);
 (%bar,$a,$b) = (%foo,'how','now');
-print $bar{'foo'} eq 'bar' ? "ok 25\n" : "not ok 25\n";
-print $bar{'how'} eq 'now' ? "ok 26\n" : "not ok 26\n";
+is($bar{'foo'}, 'bar');
+is($bar{'how'}, 'now');
 @bar{keys %foo} = values %foo;
-print $bar{'foo'} eq 'bar' ? "ok 27\n" : "not ok 27\n";
-print $bar{'how'} eq 'now' ? "ok 28\n" : "not ok 28\n";
+is($bar{'foo'}, 'bar');
+is($bar{'how'}, 'now');
 
 @foo = grep(/e/,split(' ','now is the time for all good men to come to'));
-print join(' ',@foo) eq 'the time men come' ? "ok 29\n" : "not ok 29\n";
+is(join(' ',@foo), 'the time men come');
 
 @foo = grep(!/e/,split(' ','now is the time for all good men to come to'));
-print join(' ',@foo) eq 'now is for all good to to' ? "ok 30\n" : "not ok 
30\n";
+is(join(' ',@foo), 'now is for all good to to');
 
 $foo = join('',('a','b','c','d','e','f')[0..5]);
-print $foo eq 'abcdef' ? "ok 31\n" : "not ok 31\n";
+is($foo, 'abcdef');
 
 $foo = join('',('a','b','c','d','e','f')[0..1]);
-print $foo eq 'ab' ? "ok 32\n" : "not ok 32\n";
+is($foo, 'ab');
 
 $foo = join('',('a','b','c','d','e','f')[6]);
-print $foo eq '' ? "ok 33\n" : "not ok 33\n";
+is($foo, '');
 
 @foo = ('a','b','c','d','e','f')[0,2,4];
 @bar = ('a','b','c','d','e','f')[1,3,5];
 $foo = join('',(@foo,@bar)[0..5]);
-print $foo eq 'acebdf' ? "ok 34\n" : "not ok 34\n";
+is($foo, 'acebdf');
 
 $foo = ('a','b','c','d','e','f')[0,2,4];
-print $foo eq 'e' ? "ok 35\n" : "not ok 35\n";
+is($foo, 'e');
 
 $foo = ('a','b','c','d','e','f')[1];
-print $foo eq 'b' ? "ok 36\n" : "not ok 36\n";
+is($foo, 'b');
 
 @foo = ( 'foo', 'bar', 'burbl');
 push(foo, 'blah');
-print $#foo == 3 ? "ok 37\n" : "not ok 37\n";
+is($#foo, 3);
 
 # various AASSIGN_COMMON checks (see newASSIGNOP() in op.c)
 
-$test = 37;
-sub t { ++$test; print "not " unless $_[0]; print "ok $test\n"; }
+#curr_test(38);
 
 @foo = @foo;
-t("@foo" eq "foo bar burbl blah");                             # 38
+is("@foo", "foo bar burbl blah");                              # 38
 
 (undef,@foo) = @foo;
-t("@foo" eq "bar burbl blah");                                 # 39
+is("@foo", "bar burbl blah");                                  # 39
 
 @foo = ('XXX',@foo, 'YYY');
-t("@foo" eq "XXX bar burbl blah YYY");                         # 40
+is("@foo", "XXX bar burbl blah YYY");                          # 40
 
 @foo = @foo = qw(foo b\a\r bu\\rbl blah);
-t("@foo" eq 'foo b\a\r bu\\rbl blah');                         # 41
+is("@foo", 'foo b\a\r bu\\rbl blah');                          # 41
 
 @bar = @foo = qw(foo bar);                                     # 42
-t("@foo" eq "foo bar");
-t("@bar" eq "foo bar");                                                # 43
+is("@foo", "foo bar");
+is("@bar", "foo bar");                                         # 43
 
 # try the same with local
 # XXX tie-stdarray fails the tests involving local, so we use
@@ -159,103 +150,95 @@
 {
 
     local @bee = @bee;
-    t("@bee" eq "foo bar burbl blah");                         # 44
+    is("@bee", "foo bar burbl blah");                          # 44
     {
        local (undef,@bee) = @bee;
-       t("@bee" eq "bar burbl blah");                          # 45
+       is("@bee", "bar burbl blah");                           # 45
        {
            local @bee = ('XXX',@bee,'YYY');
-           t("@bee" eq "XXX bar burbl blah YYY");              # 46
+           is("@bee", "XXX bar burbl blah YYY");               # 46
            {
                local @bee = local(@bee) = qw(foo bar burbl blah);
-               t("@bee" eq "foo bar burbl blah");              # 47
+               is("@bee", "foo bar burbl blah");               # 47
                {
                    local (@bim) = local(@bee) = qw(foo bar);
-                   t("@bee" eq "foo bar");                     # 48
-                   t("@bim" eq "foo bar");                     # 49
+                   is("@bee", "foo bar");                      # 48
+                   is("@bim", "foo bar");                      # 49
                }
-               t("@bee" eq "foo bar burbl blah");              # 50
+               is("@bee", "foo bar burbl blah");               # 50
            }
-           t("@bee" eq "XXX bar burbl blah YYY");              # 51
+           is("@bee", "XXX bar burbl blah YYY");               # 51
        }
-       t("@bee" eq "bar burbl blah");                          # 52
+       is("@bee", "bar burbl blah");                           # 52
     }
-    t("@bee" eq "foo bar burbl blah");                         # 53
+    is("@bee", "foo bar burbl blah");                          # 53
 }
 
 # try the same with my
 {
 
     my @bee = @bee;
-    t("@bee" eq "foo bar burbl blah");                         # 54
+    is("@bee", "foo bar burbl blah");                          # 54
     {
        my (undef,@bee) = @bee;
-       t("@bee" eq "bar burbl blah");                          # 55
+       is("@bee", "bar burbl blah");                           # 55
        {
            my @bee = ('XXX',@bee,'YYY');
-           t("@bee" eq "XXX bar burbl blah YYY");              # 56
+           is("@bee", "XXX bar burbl blah YYY");               # 56
            {
                my @bee = my @bee = qw(foo bar burbl blah);
-               t("@bee" eq "foo bar burbl blah");              # 57
+               is("@bee", "foo bar burbl blah");               # 57
                {
                    my (@bim) = my(@bee) = qw(foo bar);
-                   t("@bee" eq "foo bar");                     # 58
-                   t("@bim" eq "foo bar");                     # 59
+                   is("@bee", "foo bar");                      # 58
+                   is("@bim", "foo bar");                      # 59
                }
-               t("@bee" eq "foo bar burbl blah");              # 60
+               is("@bee", "foo bar burbl blah");               # 60
            }
-           t("@bee" eq "XXX bar burbl blah YYY");              # 61
+           is("@bee", "XXX bar burbl blah YYY");               # 61
        }
-       t("@bee" eq "bar burbl blah");                          # 62
+       is("@bee", "bar burbl blah");                           # 62
     }
-    t("@bee" eq "foo bar burbl blah");                         # 63
+    is("@bee", "foo bar burbl blah");                          # 63
 }
 
 # make sure reification behaves
-my $t = 63;
-sub reify { $_[1] = ++$t; print "@_\n"; }
+my $t = curr_test();
+sub reify { $_[1] = $t++; print "@_\n"; }
 reify('ok');
 reify('ok');
 
-# qw() is no more a runtime split, it's compiletime.
-print "not " unless qw(foo bar snorfle)[2] eq 'snorfle';
-print "ok 66\n";
-
[EMAIL PROTECTED] = (12,23,34,45,56);
+curr_test($t);
 
-print "not " unless shift(@ary) == 12;
-print "ok 67\n";
+# qw() is no longer a runtime split, it's compiletime.
+is (qw(foo bar snorfle)[2], 'snorfle');
 
-print "not " unless pop(@ary) == 56;
-print "ok 68\n";
-
-print "not " unless push(@ary,56) == 4;
-print "ok 69\n";
[EMAIL PROTECTED] = (12,23,34,45,56);
 
-print "not " unless unshift(@ary,12) == 5;
-print "ok 70\n";
+is(shift(@ary), 12);
+is(pop(@ary), 56);
+is(push(@ary,56), 4);
+is(unshift(@ary,12), 5);
 
 sub foo { "a" }
 @foo=(foo())[0,0];
-$foo[1] eq "a" or print "not ";
-print "ok 71\n";
+is ($foo[1], "a");
 
 # $[ should have the same effect regardless of whether the aelem
 #    op is optimized to aelemfast.
 
+
+
 sub tary {
   local $[ = 10;
   my $five = 5;
-  print "not " unless $tary[5] == $tary[$five];
-  print "ok 72\n";
+  is ($tary[5], $tary[$five]);
 }
 
 @tary = (0..50);
 tary();
 
 
-require './test.pl';
-
 # bugid #15439 - clearing an array calls destructors which may try
 # to modify the array - caused 'Attempt to free unreferenced scalar'
 
@@ -269,31 +252,28 @@
     );
 
 $got =~ s/\n/ /g;
-print "# $got\nnot " unless $got eq '';
-print "ok 73\n";
+is ($got, '');
 
 # Test negative and funky indices.
 
+
 {
     my @a = 0..4;
-    print $a[-1] == 4 ? "ok 74\n" : "not ok 74\n";
-    print $a[-2] == 3 ? "ok 75\n" : "not ok 75\n";
-    print $a[-5] == 0 ? "ok 76\n" : "not ok 76\n";
-    print defined $a[-6] ? "not ok 77\n" : "ok 77\n";
-
-    print $a[2.1]   == 2 ? "ok 78\n" : "not ok 78\n";
-    print $a[2.9]   == 2 ? "ok 79\n" : "not ok 79\n";
-    print $a[undef] == 0 ? "ok 80\n" : "not ok 80\n";
-    print $a["3rd"] == 3 ? "ok 81\n" : "not ok 81\n";
+    is($a[-1], 4);
+    is($a[-2], 3);
+    is($a[-5], 0);
+    ok(!defined $a[-6]);
+
+    is($a[2.1]  , 2);
+    is($a[2.9]  , 2);
+    is($a[undef], 0);
+    is($a["3rd"], 3);
 }
 
-sub kindalike { # TODO: test.pl-ize the array.t.
-    my ($s, $r, $m, $n) = @_;
-    print $s =~ /$r/ ? "ok $n - $m\n" : "not ok $n - $m ($s)\n";
-}
 
 {
     my @a;
     eval '$a[-1] = 0';
-    kindalike($@, qr/Modification of non-creatable array value attempted, 
subscript -1/, "\$a[-1] = 0", 82);
+    like($@, qr/Modification of non-creatable array value attempted, subscript 
-1/, "\$a[-1] = 0");
 }
+

==== //depot/maint-5.8/perl/t/op/bless.t#2 (text) ====
Index: perl/t/op/bless.t
--- perl/t/op/bless.t#1~17645~  Fri Jul 19 12:29:57 2002
+++ perl/t/op/bless.t   Tue Sep 13 14:31:42 2005
@@ -1,51 +1,51 @@
 #!./perl
 
-print "1..31\n";
-
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    require './test.pl';
 }
 
+plan (106);
+
 sub expected {
     my($object, $package, $type) = @_;
-    return "" if (
-       ref($object) eq $package
-       && "$object" =~ /^\Q$package\E=(\w+)\(0x([0-9a-f]+)\)$/
-       && $1 eq $type
-       # in 64-bit platforms hex warns for 32+ -bit values
-       && do { no warnings 'portable'; hex($2) == $object }
-    );
     print "# $object $package $type\n";
-    return "not ";
+    is(ref($object), $package);
+    my $r = qr/^\Q$package\E=(\w+)\(0x([0-9a-f]+)\)$/;
+    like("$object", $r);
+    "$object" =~ $r;
+    is($1, $type);
+    # in 64-bit platforms hex warns for 32+ -bit values
+    cmp_ok(do {no warnings 'portable'; hex($2)}, '==', $object);
 }
 
 # test blessing simple types
 
 $a1 = bless {}, "A";
-print expected($a1, "A", "HASH"), "ok 1\n";
+expected($a1, "A", "HASH");
 $b1 = bless [], "B";
-print expected($b1, "B", "ARRAY"), "ok 2\n";
+expected($b1, "B", "ARRAY");
 $c1 = bless \(map "$_", "test"), "C";
-print expected($c1, "C", "SCALAR"), "ok 3\n";
+expected($c1, "C", "SCALAR");
 our $test = "foo"; $d1 = bless \*test, "D";
-print expected($d1, "D", "GLOB"), "ok 4\n";
+expected($d1, "D", "GLOB");
 $e1 = bless sub { 1 }, "E";
-print expected($e1, "E", "CODE"), "ok 5\n";
+expected($e1, "E", "CODE");
 $f1 = bless \[], "F";
-print expected($f1, "F", "REF"), "ok 6\n";
+expected($f1, "F", "REF");
 $g1 = bless \substr("test", 1, 2), "G";
-print expected($g1, "G", "LVALUE"), "ok 7\n";
+expected($g1, "G", "LVALUE");
 
 # blessing ref to object doesn't modify object
 
-print expected(bless(\$a1, "F"), "F", "REF"), "ok 8\n";
-print expected($a1, "A", "HASH"), "ok 9\n";
+expected(bless(\$a1, "F"), "F", "REF");
+expected($a1, "A", "HASH");
 
 # reblessing does modify object
 
 bless $a1, "A2";
-print expected($a1, "A2", "HASH"), "ok 10\n";
+expected($a1, "A2", "HASH");
 
 # local and my
 {
@@ -53,37 +53,36 @@
     local $b1 = bless [], "B3";
     my $c1 = bless $c1, "C3";          # should rebless outer $c1
     our $test2 = ""; my $d1 = bless \*test2, "D3";
-    print expected($a1, "A3", "HASH"), "ok 11\n";
-    print expected($b1, "B3", "ARRAY"), "ok 12\n";
-    print expected($c1, "C3", "SCALAR"), "ok 13\n";
-    print expected($d1, "D3", "GLOB"), "ok 14\n";
-}
-print expected($a1, "A3", "HASH"), "ok 15\n";
-print expected($b1, "B", "ARRAY"), "ok 16\n";
-print expected($c1, "C3", "SCALAR"), "ok 17\n";
-print expected($d1, "D", "GLOB"), "ok 18\n";
+    expected($a1, "A3", "HASH");
+    expected($b1, "B3", "ARRAY");
+    expected($c1, "C3", "SCALAR");
+    expected($d1, "D3", "GLOB");
+}
+expected($a1, "A3", "HASH");
+expected($b1, "B", "ARRAY");
+expected($c1, "C3", "SCALAR");
+expected($d1, "D", "GLOB");
 
 # class is magic
 "E" =~ /(.)/;
-print expected(bless({}, $1), "E", "HASH"), "ok 19\n";
+expected(bless({}, $1), "E", "HASH");
 {
     local $! = 1;
     my $string = "$!";
     $! = 2;    # attempt to avoid cached string
     $! = 1;
-    print expected(bless({}, $!), $string, "HASH"), "ok 20\n";
+    expected(bless({}, $!), $string, "HASH");
 
 # ref is ref to magic
     {
        {
            package F;
-           sub test { ${$_[0]} eq $string or print "not " }
+           sub test { main::is(${$_[0]}, $string) }
        }
        $! = 2;
        $f1 = bless \$!, "F";
        $! = 1;
        $f1->test;
-       print "ok 21\n";
     }
 }
 
@@ -91,30 +90,30 @@
 ### example of magic variable that is a reference??
 
 # no class, or empty string (with a warning), or undef (with two)
-print expected(bless([]), 'main', "ARRAY"), "ok 22\n";
+expected(bless([]), 'main', "ARRAY");
 {
     local $SIG{__WARN__} = sub { push @w, join '', @_ };
     use warnings;
 
     $m = bless [];
-    print expected($m, 'main', "ARRAY"), "ok 23\n";
-    print @w ? "not ok 24\t# @w\n" : "ok 24\n";
+    expected($m, 'main', "ARRAY");
+    is (scalar @w, 0);
 
     @w = ();
     $m = bless [], '';
-    print expected($m, 'main', "ARRAY"), "ok 25\n";
-    print @w != 1 ? "not ok 26\t# @w\n" : "ok 26\n";
+    expected($m, 'main', "ARRAY");
+    is (scalar @w, 1);
 
     @w = ();
     $m = bless [], undef;
-    print expected($m, 'main', "ARRAY"), "ok 27\n";
-    print @w != 2 ? "not ok 28\t# @w\n" : "ok 28\n";
+    expected($m, 'main', "ARRAY");
+    is (scalar @w, 2);
 }
 
 # class is a ref
 $a1 = bless {}, "A4";
 $b1 = eval { bless {}, $a1 };
-print $@ ? "ok 29\n" : "not ok 29\t# $b1\n";
+isnt ($@, '', "class is a ref");
 
 # class is an overloaded ref
 {
@@ -123,5 +122,5 @@
 }
 $h1 = bless {}, "H4";
 $c4 = eval { bless \$test, $h1 };
-print expected($c4, 'C4', "SCALAR"), "ok 30\n";
-print $@ ? "not ok 31\t# $@" : "ok 31\n";
+is ($@, '', "class is an overloaded ref");
+expected($c4, 'C4', "SCALAR");

==== //depot/maint-5.8/perl/t/op/mkdir.t#5 (xtext) ====
Index: perl/t/op/mkdir.t
--- perl/t/op/mkdir.t#4~22089~  Wed Jan  7 05:19:41 2004
+++ perl/t/op/mkdir.t   Tue Sep 13 14:31:42 2005
@@ -1,12 +1,13 @@
 #!./perl
 
-print "1..13\n";
-
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    require './test.pl';
 }
 
+plan tests => 13;
+
 use File::Path;
 rmtree('blurfl');
 
@@ -14,22 +15,22 @@
 $ENV{'LC_ALL'} = 'C';
 $ENV{LANGUAGE} = 'C'; # GNU locale extension
 
-print (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n");
-print (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n");
-print ($! =~ /cannot move|exist|denied/ ? "ok 3\n" : "# $!\nnot ok 3\n");
-print (-d 'blurfl' ? "ok 4\n" : "not ok 4\n");
-print (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n");
-print (rmdir('blurfl') ? "not ok 6\n" : "ok 6\n");
-print ($! =~ /cannot find|such|exist|not found|not a directory/i ? "ok 7\n" : 
"# $!\nnot ok 7\n");
-print (mkdir('blurfl') ? "ok 8\n" : "not ok 8\n");
-print (rmdir('blurfl') ? "ok 9\n" : "not ok 9\n");
-# trailing slashes will be removed before the system call to mkdir
-# but we don't care for MacOS ...
-if ($^O eq 'MacOS') {
-   print "ok $_\n" for 10..13;
-} else {
-   print (mkdir('blurfl///') ? "ok 10\n" : "not ok 10\n");
-   print (-d 'blurfl' ? "ok 11\n" : "not ok 11\n");
-   print (rmdir('blurfl///') ? "ok 12\n" : "not ok 12\n");
-   print (!-d 'blurfl' ? "ok 13\n" : "not ok 13\n");
+ok(mkdir('blurfl',0777));
+ok(!mkdir('blurfl',0777));
+like($!, qr/cannot move|exist|denied/);
+ok(-d 'blurfl');
+ok(rmdir('blurfl'));
+ok(!rmdir('blurfl'));
+like($!, qr/cannot find|such|exist|not found|not a directory/i);
+ok(mkdir('blurfl'));
+ok(rmdir('blurfl'));
+
+SKIP: {
+    # trailing slashes will be removed before the system call to mkdir
+    # but we don't care for MacOS ...
+    skip("MacOS", 4) if $^O eq 'MacOS';
+    ok(mkdir('blurfl///'));
+    ok(-d 'blurfl');
+    ok(rmdir('blurfl///'));
+    ok(!-d 'blurfl');
 }

==== //depot/maint-5.8/perl/t/op/vec.t#3 (xtext) ====
Index: perl/t/op/vec.t
--- perl/t/op/vec.t#2~18744~    Tue Feb 18 06:46:18 2003
+++ perl/t/op/vec.t     Tue Sep 13 14:31:42 2005
@@ -1,91 +1,90 @@
 #!./perl
 
-print "1..31\n";
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = qw(. ../lib);
+}
+
+require "test.pl";
+plan( tests => 31 );
 
 my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0;
 
-print vec($foo,0,1) == 0 ? "ok 1\n" : "not ok 1\n";
-print length($foo) == 0 ? "ok 2\n" : "not ok 2\n";
+is(vec($foo,0,1), 0);
+is(length($foo), 0);
 vec($foo,0,1) = 1;
-print length($foo) == 1 ? "ok 3\n" : "not ok 3\n";
-print unpack('C',$foo) == 1 ? "ok 4\n" : "not ok 4\n";
-print vec($foo,0,1) == 1 ? "ok 5\n" : "not ok 5\n";
+is(length($foo), 1);
+is(unpack('C',$foo), 1);
+is(vec($foo,0,1), 1);
 
-print vec($foo,20,1) == 0 ? "ok 6\n" : "not ok 6\n";
+is(vec($foo,20,1), 0);
 vec($foo,20,1) = 1;
-print vec($foo,20,1) == 1 ? "ok 7\n" : "not ok 7\n";
-print length($foo) == 3 ? "ok 8\n" : "not ok 8\n";
-print vec($foo,1,8) == 0 ? "ok 9\n" : "not ok 9\n";
+is(vec($foo,20,1), 1);
+is(length($foo), 3);
+is(vec($foo,1,8), 0);
 vec($foo,1,8) = 0xf1;
-print vec($foo,1,8) == 0xf1 ? "ok 10\n" : "not ok 10\n";
-print ((unpack('C',substr($foo,1,1)) & 255) == 0xf1 ? "ok 11\n" : "not ok 
11\n");
-print vec($foo,2,4) == 1 ? "ok 12\n" : "not ok 12\n";
-print vec($foo,3,4) == 15 ? "ok 13\n" : "not ok 13\n";
+is(vec($foo,1,8), 0xf1);
+is((unpack('C',substr($foo,1,1)) & 255), 0xf1);
+is(vec($foo,2,4), 1);;
+is(vec($foo,3,4), 15);
 vec($Vec, 0, 32) = 0xbaddacab;
-print $Vec eq "\xba\xdd\xac\xab" ? "ok 14\n" : "not ok 14\n";
-print vec($Vec, 0, 32) == 3135089835 ? "ok 15\n" : "not ok 15\n";
+is($Vec, "\xba\xdd\xac\xab");
+is(vec($Vec, 0, 32), 3135089835);
 
 # ensure vec() handles numericalness correctly
 $foo = $bar = $baz = 0;
 vec($foo = 0,0,1) = 1;
 vec($bar = 0,1,1) = 1;
 $baz = $foo | $bar;
-print $foo eq "1" && $foo == 1 ? "ok 16\n" : "not ok 16\n";
-print $bar eq "2" && $bar == 2 ? "ok 17\n" : "not ok 17\n";
-print "$foo $bar $baz" eq "1 2 3" ? "ok 18\n" : "not ok 18\n";
+ok($foo eq "1" && $foo == 1);
+ok($bar eq "2" && $bar == 2);
+ok("$foo $bar $baz" eq "1 2 3");
 
 # error cases
 
 $x = eval { vec $foo, 0, 3 };
-print "not " if defined $x or $@ !~ /^Illegal number of bits in vec/;
-print "ok 19\n";
+like($@, /^Illegal number of bits in vec/);
+$@ = undef;
 $x = eval { vec $foo, 0, 0 };
-print "not " if defined $x or $@ !~ /^Illegal number of bits in vec/;
-print "ok 20\n";
+like($@, /^Illegal number of bits in vec/);
+$@ = undef;
 $x = eval { vec $foo, 0, -13 };
-print "not " if defined $x or $@ !~ /^Illegal number of bits in vec/;
-print "ok 21\n";
+like($@, /^Illegal number of bits in vec/);
+$@ = undef;
 $x = eval { vec($foo, -1, 4) = 2 };
-print "not " if defined $x or $@ !~ /^Negative offset to vec in lvalue 
context/;
-print "ok 22\n";
-print "not " if vec('abcd', 7, 8);
-print "ok 23\n";
+like($@, /^Illegal number of bits in vec/);
+$@ = undef;
+ok(! vec('abcd', 7, 8));
 
 # UTF8
 # N.B. currently curiously coded to circumvent bugs elswhere in UTF8 handling
 
 $foo = "\x{100}" . "\xff\xfe";
 $x = substr $foo, 1;
-print "not " if vec($x, 0, 8) != 255;
-print "ok 24\n";
+is(vec($x, 0, 8), 255);
+$@ = undef;
 eval { vec($foo, 1, 8) };
-print "not " if $@;
-print "ok 25\n";
+ok(! $@);
+$@ = undef;
 eval { vec($foo, 1, 8) = 13 };
-print "not " if $@;
-print "ok 26\n";
+ok(! $@);
 if ($Is_EBCDIC) {
-    print "not " if $foo ne "\x8c\x0d\xff\x8a\x69";
-    print "ok 27\n";
+    is($foo, "\x8c\x0d\xff\x8a\x69"); 
 }
 else {
-    print "not " if $foo ne "\xc4\x0d\xc3\xbf\xc3\xbe";
-    print "ok 27\n";
+    is($foo, "\xc4\x0d\xc3\xbf\xc3\xbe");
 }
 $foo = "\x{100}" . "\xff\xfe";
 $x = substr $foo, 1;
 vec($x, 2, 4) = 7;
-print "not " if $x ne "\xff\xf7";
-print "ok 28\n";
+is($x, "\xff\xf7");
 
 # mixed magic
 
 $foo = "\x61\x62\x63\x64\x65\x66";
-print "not " if vec(substr($foo, 2, 2), 0, 16) != 25444;
-print "ok 29\n";
+is(vec(substr($foo, 2, 2), 0, 16), 25444);
 vec(substr($foo, 1,3), 5, 4) = 3;
-print "not " if $foo ne "\x61\x62\x63\x34\x65\x66";
-print "ok 30\n";
+is($foo, "\x61\x62\x63\x34\x65\x66");
 
 # A variation of [perl #20933]
 {
@@ -94,6 +93,5 @@
     vec($s, 1, 1) = 1;
     my @r;
     $r[$_] = \ vec $s, $_, 1 for (0, 1);
-    print "not " if (${ $r[0] } != 0 || ${ $r[1] } != 1);
-    print "ok 31\n";
+    ok(!(${ $r[0] } != 0 || ${ $r[1] } != 1)); 
 }
End of Patch.

Reply via email to