Skip to content

Commit

Permalink
[Test.pm] don't autothread over ok(), is()
Browse files Browse the repository at this point in the history
Previously calls to tests subs would would do autothreading unless a negation
was involved - which is an implementation detail and should be hidden.
Now no test function should autothread at all, which is usually what the test
write expects.
  • Loading branch information
moritz committed Feb 23, 2009
1 parent fa51bd7 commit 92d94aa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Test.pm
Expand Up @@ -51,10 +51,10 @@ multi sub pass($desc) is export() {
}

multi sub ok(Object $cond, $desc) is export() {
proclaim($cond, $desc);
proclaim(?$cond, $desc);
}

multi sub ok(Object $cond) is export() { ok($cond, ''); }
multi sub ok(Object $cond) is export() { ok(?$cond, ''); }


multi sub nok(Object $cond, $desc) is export() {
Expand All @@ -66,7 +66,7 @@ multi sub nok(Object $cond) is export() { nok(!$cond, ''); }

multi sub is(Object $got, Object $expected, $desc) is export() {
my $test = $got eq $expected;
proclaim($test, $desc);
proclaim(?$test, $desc);
}

multi sub is(Object $got, Object $expected) is export() { is($got, $expected, ''); }
Expand All @@ -81,10 +81,12 @@ multi sub isnt(Object $got, Object $expected) is export() { isnt($got, $expected

multi sub is_approx(Object $got, Object $expected, $desc) is export() {
my $test = abs($got - $expected) <= 0.00001;
proclaim($test, $desc);
proclaim(?$test, $desc);
}

multi sub is_approx($got, $expected) is export() { is_approx($got, $expected, ''); }
multi sub is_approx(Object $got, Object $expected) is export() {
is_approx($got, $expected, '');
}

multi sub todo($reason, $count) is export() {
$todo_upto_test_num = $num_of_tests_run + $count;
Expand Down

0 comments on commit 92d94aa

Please sign in to comment.