File: basic.t

package info (click to toggle)
libtap-simpleoutput-perl 0.002-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 208 kB
  • ctags: 2
  • sloc: perl: 107; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,628 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use strict;
use warnings;
use utf8;

use Test::More;
use TAP::SimpleOutput 'counters';

{
    my ($_ok, $_nok, $_skip, $_plan, $_todo) = counters();
    my @output;
    push @output, $_ok->('TestClass has a metaclass');
    push @output, $_skip->('TestClass is a Moose class');
    push @output, $_nok->('TestClass has an attribute named bar');
    push @output, $_ok->('TestClass has an attribute named baz');
    do {
        my ($_ok, $_nok, $_skip, $_plan) = counters(1);
        push @output, $_ok->(q{TestClass's attribute baz does TestRole::Two});
        push @output, $_ok->(q{TestClass's attribute baz has a reader});
        push @output, $_ok->(q{TestClass's attribute baz option reader correct});
        push @output, $_plan->();
    };
    push @output, $_ok->(q{[subtest] checking TestClass's attribute baz});
    push @output, $_todo->($_ok->('TestClass has an attribute named foo'), 'next');

    my @expected = (
        q{ok 1 - TestClass has a metaclass},
        q{ok 2 # skip TestClass is a Moose class},
        q{not ok 3 - TestClass has an attribute named bar},
        q{ok 4 - TestClass has an attribute named baz},
        q{    ok 1 - TestClass's attribute baz does TestRole::Two},
        q{    ok 2 - TestClass's attribute baz has a reader},
        q{    ok 3 - TestClass's attribute baz option reader correct},
        q{    1..3},
        q{ok 5 - [subtest] checking TestClass's attribute baz},
        q{ok 6 - TestClass has an attribute named foo # TODO next},
    );

    is_deeply
        [ @output   ],
        [ @expected ],
        'TAP output as expected',
        ;

}

done_testing;