Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[Test.pm] added 'done' (and 'done_testing')
Heavily inspired by Rakudo's Test.pm.
  • Loading branch information
Carl Masak committed Feb 18, 2012
1 parent ffda141 commit 27f1db4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Pugs/ext/Test/lib/Test.pm
Expand Up @@ -210,6 +210,20 @@ sub lives_ok (Code &code, Str $desc?, :$todo, :$depends) returns Bool is export
}
}

sub done_testing() is export {
die "done_testing() has been renamed to done(), please change your test code";
}

sub done() is export {
$Test::testing_done = 1;

unless $Test::num_of_tests_planned {
$Test::num_of_tests_planned = $Test::num_of_tests_run;
}

test_ends();
}

## misc. test utilities

sub version_lt (Str $version1, Str $version2) returns Bool {
Expand Down Expand Up @@ -376,7 +390,11 @@ sub test_ends {
$Test::testing_started = 0;
}

END { Test::test_ends() }
END {
unless $Test::done_testing {
Test::test_ends();
}
}

=pod

Expand Down

0 comments on commit 27f1db4

Please sign in to comment.