Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add in a few more functions and a few more tests
  • Loading branch information
Stevan Little committed Apr 6, 2013
1 parent 6ad6345 commit 20e93b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
20 changes: 20 additions & 0 deletions lib/Test-More/lib/Test/More.mo
Expand Up @@ -6,6 +6,10 @@ package Test::More {
say(1, "..", $count);
}

sub done_testing is export {
say(1, "..", $test_count)
}

sub ok ($test, $msg?) is export {
$test_count = $test_count + 1;
if ($test) {
Expand All @@ -22,4 +26,20 @@ package Test::More {
}
}

sub is ($got, $expected, $msg?) is export {
$test_count = $test_count + 1;
if (~$got eq ~$expected) {
# NOTE:
# the "".pad(1) silliness is because
# the parser (for some reason) does
# not like strings with just spaces
# and instead gives back an empty string
# and I can't figure it out.
# - SL
say([ "ok", $test_count, ($msg || "") ].join("".pad(1)));
} else {
say([ "not ok", $test_count, ($msg || "") ].join("".pad(1)))
}
}

}
7 changes: 5 additions & 2 deletions lib/Test-More/t/001-basic.t
@@ -1,5 +1,8 @@
use Test::More;

plan(1);
ok(true, "... this works");
is(5, 5, "... this works too");
is(5, '5', "... and this works too");
is("foo", 'foo', "... and so does this")

ok(true, "... this works");
done_testing();

0 comments on commit 20e93b9

Please sign in to comment.