xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Simple/t/Test2/behavior/special_names.t (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
1use strict;
2use warnings;
3# HARNESS-NO-FORMATTER
4
5use Test2::Tools::Tiny;
6
7#########################
8#
9# This test us here to insure that Ok renders the way we want
10#
11#########################
12
13use Test2::API qw/test2_stack/;
14
15# Ensure the top hub is generated
16test2_stack->top;
17
18my $temp_hub = test2_stack->new_hub();
19require Test2::Formatter::TAP;
20$temp_hub->format(Test2::Formatter::TAP->new);
21
22my $ok = capture {
23    ok(1);
24    ok(1, "");
25    ok(1, " ");
26    ok(1, "A");
27    ok(1, "\n");
28    ok(1, "\nB");
29    ok(1, "C\n");
30    ok(1, "\nD\n");
31    ok(1, "E\n\n");
32};
33
34my $not_ok = capture {
35    ok(0);
36    ok(0, "");
37    ok(0, " ");
38    ok(0, "A");
39    ok(0, "\n");
40    ok(0, "\nB");
41    ok(0, "C\n");
42    ok(0, "\nD\n");
43    ok(0, "E\n\n");
44};
45
46test2_stack->pop($temp_hub);
47
48is($ok->{STDERR}, "", "STDERR for ok is empty");
49is($ok->{STDOUT}, <<EOT, "STDOUT looks right for ok");
50ok 1
51ok 2 -_
52ok 3 - _
53ok 4 - A
54ok 5 -_
55#     _
56ok 6 -_
57#      B
58ok 7 - C
59#     _
60ok 8 -_
61#      D
62#     _
63ok 9 - E
64#     _
65#     _
66EOT
67
68is($not_ok->{STDOUT}, <<EOT, "STDOUT looks right for not ok");
69not ok 10
70not ok 11 -_
71not ok 12 - _
72not ok 13 - A
73not ok 14 -_
74#          _
75not ok 15 -_
76#           B
77not ok 16 - C
78#          _
79not ok 17 -_
80#           D
81#          _
82not ok 18 - E
83#          _
84#          _
85EOT
86
87
88done_testing;
89