Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test::More returns true if succeeded

  • Loading branch information...
commit 6673e1d67fc153a5a7d8587d18745e72975ecacf 1 parent 8919891
@tokuhirom authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/Test/More.tra
View
8 lib/Test/More.tra
@@ -18,8 +18,10 @@ class Test::Builder {
sub ok($b, $msg=undef) {
if ($b) {
self.pass($msg);
+ return true;
} else {
self.fail($msg);
+ return false;
}
}
sub pass($msg=undef) {
@@ -29,6 +31,7 @@ class Test::Builder {
print(" - " + $msg);
}
print("\n");
+ return true;
}
sub fail($msg=undef) {
self.incr_counter();
@@ -38,10 +41,12 @@ class Test::Builder {
}
print("\n");
self.incr_failed;
+ return false;
}
sub is($a, $b, $msg=undef) {
if ($a==$b) {
self.pass($msg);
+ return true;
} else {
self.incr_counter;
print("not ok " + self.counter);
@@ -52,6 +57,7 @@ class Test::Builder {
say(" # got: " + $a);
say(" # expected: " + $b);
self.incr_failed;
+ return false;
}
}
sub like($a, $b, $msg=undef) {
@@ -62,6 +68,7 @@ class Test::Builder {
print(" - " + $msg);
}
print("\n");
+ return true;
} else {
print("not ok " + self.counter);
if $msg!=undef {
@@ -70,6 +77,7 @@ class Test::Builder {
say(" # got: " + $a);
say(" # expected: " + $b);
self.incr_failed;
+ return false;
}
}
sub note($msg) {
Please sign in to comment.
Something went wrong with that request. Please try again.