xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Simple/t/regression/todo_and_facets.t (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
1use strict;
2use warnings;
3
4use Test2::API qw/context/;
5
6use Test2::Tools::Tiny qw/done_testing todo/;
7use Test::More();
8
9BEGIN {
10    *tm_ok = \&Test::More::ok;
11    *tm_pass = \&Test::More::pass;
12    *tm_fail = \&Test::More::fail;
13}
14
15use vars qw/$TODO/;
16
17sub leg_ok($;$@) {
18    my ($bool, $name, @diag);
19    my $ctx = context();
20    $ctx->ok($bool, $name, \@diag);
21    $ctx->release;
22
23    return $bool;
24}
25
26sub new_ok($;$@) {
27    my ($bool, $name, @diag) = @_;
28    my $ctx = context();
29
30    return $ctx->pass_and_release($name) if $bool;
31    return $ctx->fail_and_release($name, @diag);
32}
33
34{
35    local $TODO = "Testing TODO";
36
37    tm_ok(0, "tm_ok fail");
38    tm_fail('tm_fail');
39
40    leg_ok(0, "legacy ok fail");
41    new_ok(0, "new ok fail");
42}
43
44todo new_todo_test => sub {
45    tm_ok(0, "tm_ok fail");
46    tm_fail('tm_fail');
47
48    leg_ok(0, "legacy ok fail");
49    new_ok(0, "new ok fail");
50};
51
52done_testing;
53