Here's a patch to make various tests use Test.pm
-Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Index: t/op/shift.t =================================================================== --- t/op/shift.t (revision 234) +++ t/op/shift.t (working copy) @@ -1,14 +1,13 @@ use v6; +require Test; -say "1..6"; +plan(6); my @s = (1, 2, 3, 4, 5); -if (eval 'shift(@s)' == 1) { say "ok 1 # TODO shift" } else { say "not ok 1 # TODO shift" } -if (eval 'shift(@s)' == 2) { say "ok 2 # TODO split" } else { say "not ok 2 # TODO shift" } -if (eval 'shift(@s)' == 3) { say "ok 3 # TODO split" } else { say "not ok 3 # TODO shift" } -if (eval 'shift(@s)' == 4) { say "ok 4 # TODO split" } else { say "not ok 4 # TODO shift" } -if (eval '@s.shift' == 5) { say "ok 5 # TODO split" } else { say "not ok 5 # TODO shift" } -if (eval 'defined(shift(@s))') { say "not ok 6 # TODO shift" } else { - say "ok 6 # TODO split" -} +todo_ok (eval 'shift(@s)' == 1, "shift"); +todo_ok (eval 'shift(@s)' == 2, "shift"); +todo_ok (eval 'shift(@s)' == 3, "shift"); +todo_ok (eval 'shift(@s)' == 4, "shift"); +todo_ok (eval '@s.shift' == 5, "shift method"); +todo_ok (!eval 'defined(shift(@s))', "shift"); Index: t/op/push.t =================================================================== --- t/op/push.t (revision 234) +++ t/op/push.t (working copy) @@ -1,14 +1,17 @@ use v6; +require Test; -say "1..6"; +plan(6); my @push; eval 'push @foo, 42'; -if (@push[0] == 42) { say "ok 1 # TODO push" } else { say "not ok 1 # TODO push" } +todo_ok(@push[0] == 42, "push"); + eval '@foo.push(24)'; -if (@push[0] == 42) { say "ok 2 # TODO split" } else { say "not ok 2 # TODO push" } -if (@push[1] == 24) { say "ok 3 # TODO split" } else { say "not ok 3 # TODO push" } +todo_ok(@push[0] == 42, "push"); +todo_ok(@push[1] == 42, "push"); + eval 'push @foo, 1, 2, 3'; -if (@push[2] == 1) { say "ok 4 # TODO split" } else { say "not ok 4 # TODO push" } -if (@push[3] == 2) { say "ok 5 # TODO split" } else { say "not ok 5 # TODO push" } -if (@push[4] == 3) { say "ok 6 # TODO split" } else { say "not ok 6 # TODO push" } +todo_ok(@push[2] == 1, "push"); +todo_ok(@push[3] == 2, "push"); +todo_ok(@push[4] == 3, "push"); Index: t/op/magic.t =================================================================== --- t/op/magic.t (revision 234) +++ t/op/magic.t (working copy) @@ -1,13 +1,14 @@ # Tests for magic variables use v6; +require Test; -say "1..2"; +plan(2); # Tests for %*ENV # it must not be empty at startup -if (0 + %*ENV.keys > 0) { say "ok 1"; } else { say "not ok 1"; } +ok(0 + %*ENV.keys > 0); # PATH is usually defined. But this test is not portable -if %*ENV{"PATH"} ne "" { say "ok 2"; } else { say "not ok 2"; } +ok(%*ENV{"PATH"} ne ""); Index: t/op/unshift.t =================================================================== --- t/op/unshift.t (revision 234) +++ t/op/unshift.t (working copy) @@ -1,14 +1,15 @@ use v6; +require Test; -say "1..6"; +plan(6); my @unshift; eval 'unshift @foo, 42'; -if (@unshift[0] == 42) { say "ok 1 # TODO unshift" } else { say "not ok 1 # TODO unshift" } +todo_ok (@unshift[0] == 42,"unshift"); eval '@foo.unshift(24)'; -if (@unshift[1] == 42) { say "ok 2 # TODO unshift" } else { say "not ok 2 # TODO unshift" } -if (@unshift[0] == 24) { say "ok 3 # TODO unshift" } else { say "not ok 3 # TODO unshift" } +todo_ok (@unshift[1] == 42,"unshift"); +todo_ok (@unshift[0] == 24,"unshift"); eval 'unshift @foo, 1, 2, 3'; -if (@unshift[0] == 1) { say "ok 4 # TODO unshift" } else { say "not ok 4 # TODO unshift" } -if (@unshift[1] == 2) { say "ok 5 # TODO unshift" } else { say "not ok 5 # TODO unshift" } -if (@unshift[2] == 3) { say "ok 6 # TODO unshift" } else { say "not ok 6 # TODO unshift" } +todo_ok (@unshift[0] == 1,"unshift"); +todo_ok (@unshift[1] == 2,"unshift"); +todo_ok (@unshift[2] == 3,"unshift"); Index: t/op/repeat.t =================================================================== --- t/op/repeat.t (revision 234) +++ t/op/repeat.t (working copy) @@ -1,13 +1,14 @@ use v6; +require Test; -say "1..7"; +plan(7); -if ('a' x 3 eq 'aaa') { say "ok 1" } else { say "not ok 1" } -if ('ab' x 4 eq 'abababab') { say "ok 2" } else { say "not ok 2" } -if (1 x 5 eq '11111') { say "ok 3" } else { say "not ok 3" } -if ('' x 6 eq '') { say "ok 4" } else { say "not ok 4" } +ok ('a' x 3 eq 'aaa'); +ok ('ab' x 4 eq 'abababab'); +ok (1 x 5 eq '11111'); +ok ('' x 6 eq ''); my @foo = 'x' xx 10; -if (@foo[0] eq 'x') { say "ok 5" } else { say "not ok 5" } -if (@foo[9] eq 'x') { say "ok 6" } else { say "not ok 6" } -if ([EMAIL PROTECTED] == 10) { say "ok 7" } else { say "not ok 7" } +ok (@foo[0] eq 'x'); +ok (@foo[9] eq 'x'); +ok ([EMAIL PROTECTED] == 10); Index: t/op/eval.t =================================================================== --- t/op/eval.t (revision 234) +++ t/op/eval.t (working copy) @@ -1,14 +1,15 @@ use v6; +require Test; -say "1..4"; +plan(4); # eval should evaluate the code in the lexical scope of eval's caller sub make_eval_closure { my $a = 5; sub ($s) { eval $s } }; -if (make_eval_closure()('$a') == 5) { say "ok 1" } else { say "not ok 1" } +ok(make_eval_closure()('$a') == 5); -if (eval('5') == 5) { say "ok 2" } else { say "not ok 2" } +ok(eval('5') == 5); my $foo = 1234; -if (eval('$foo') == $foo) { say "ok 3" } else { say "not ok 3" } +ok(eval('$foo') == $foo); # traps die? -if (eval('die; 1')) { say "not ok 4" } else { say "ok 4" } +ok(!eval('die; 1')); Index: t/op/split.t =================================================================== --- t/op/split.t (revision 234) +++ t/op/split.t (working copy) @@ -5,15 +5,15 @@ plan 11; -my @foo; +my @foo ok @foo = eval 'split "", "forty-two"', "split evaluated"; is [EMAIL PROTECTED], 9, "split created the correct number of elements"; -is @foo[0], "f", 'the first value of the split array is ok'; -is @foo[1], "o", 'the second value of the split array is ok'; -is @foo[2], "r", 'the third value of the split array is ok'; -is @foo[3], "t", 'the fourth value of the split array is ok'; -is @foo[4], "y", 'the fifth value of the split array is ok'; -is @foo[5], "-", 'the sixth value of the split array is ok'; -is @foo[6], "t", 'the seventh value of the split array is ok'; -is @foo[7], "w", 'the eighth value of the split array is ok'; -is @foo[8], "o", 'the ninth value of the split array is ok'; +is @foo[0], "f"; +is @foo[1], "o"; +is @foo[2], "r"; +is @foo[3], "t"; +is @foo[4], "y"; +is @foo[5], "-"; +is @foo[6], "t"; +is @foo[7], "w"; +is @foo[8], "o"; Index: t/op/pair.t =================================================================== --- t/op/pair.t (revision 234) +++ t/op/pair.t (working copy) @@ -1,45 +1,46 @@ use v6; +require Test; -say "1..13"; +plan(12); my $pair = 'foo' => 'bar'; -if (ref $pair eq 'Pair') { say "ok 1" } else { say "not ok 1" } +ok (ref $pair eq 'Pair'); my $foo = $pair.key; my $bar = $pair.value; -if ($foo eq 'foo') { say "ok 2" } else { say "not ok 2" } -if ($bar eq 'bar') { say "ok 3" } else { say "not ok 3" } +ok ($foo eq 'foo'); +ok ($bar eq 'bar'); my @pair1 = $pair.kv; -if (@pair1[0] eq 'foo') { say "ok 4" } else { say "not ok 4" } -if (@pair1[1] eq 'bar') { say "ok 5" } else { say "not ok 5" } +ok (@pair1[0] eq 'foo'); +ok (@pair1[1] eq 'bar'); my $quux = eval '(quux => "xyzzy").key'; -if ($quux eq 'quux') { say "ok 6 # TODO => lhs quotes" } else { say "not ok 6 # TODO => lhs quotes" } +todo_ok ($quux eq 'quux', "lhs quotes" ); #Pair with a numeric value my $pair = 'foo' => 2; -if (ref $pair eq 'Pair') { say "ok 7" } else { say "not ok 7" } +ok (ref $pair eq 'Pair'); say "ok 8"; my $two = $pair.value; -if ($two == 2) { say "ok 9" } else { say "not ok 9" }; +ok ($two == 2); #Pair with a Pair value my $pair = "foo" => ("bar" => "baz"); -if (ref $pair eq 'Pair') { say "ok 10" } else { say "not ok 10" } +ok (ref $pair eq 'Pair'); my $pair2 = $pair.value; -if (ref $pair2 eq 'Pair') { say "ok 11" } else { say "not ok 11" } +ok (ref $pair2 eq 'Pair'); #Pair with a Pair key $pair = ("foo" => "bar") => "baz"; -if (ref $pair eq 'Pair') { say "ok 12" } else { say "not ok 12" } +ok (ref $pair eq 'Pair'); my $key = $pair.key; -if (ref $key eq 'Pair') { say "ok 13" } else { say "not ok 13" } +ok (ref $key eq 'Pair'); #Pair list a la http://www.nntp.perl.org/group/perl.perl6.language/19360 my $list = 1 => 2 => 3 => 4; Index: t/op/eq.t =================================================================== --- t/op/eq.t (revision 234) +++ t/op/eq.t (working copy) @@ -1,21 +1,23 @@ use v6; -say "1..10"; +require Test; -if ("a" eq "a") { say "ok 1" } else { say "not ok 1" } -if ("a" eq "ab") { say "not ok 2" } else { say "ok 2" } +plan(10); -if ("a" ne "a") { say "not ok 3" } else { say "ok 3" } -if ("a" ne "ab") { say "ok 4" } else { say "not ok 4" } +ok("a" eq "a"); +ok(!("a" eq "ab")); -if ("\0" eq "\0") { say "ok 5" } else { say "not ok 5" } +ok(!("a" ne "a")); +ok("a" ne "ab"); +ok("\0" eq "\0"); + my $foo; -if ($foo eq "") { say "ok 6" } else { say "not ok 6" } -if ($foo eq "f") { say "not ok 7" } else { say "ok 7" } +ok ($foo eq ""); +ok (!($foo eq "f")); my @foo; -if (@foo[0] eq "") { say "ok 8" } else { say "not ok 8" } -if (@foo[0] eq "f") { say "not ok 9" } else { say "ok 9" } +ok (@foo[0] eq ""); +ok (@foo[0] ne "f"); @foo = eval ''; -if (@foo[0] eq "f") { say "not ok 10" } else { say "ok 10" } +ok (@foo[0] ne "f");