Class: Test::Mini::Logger::TAP

Inherits:
Test::Mini::Logger show all
Defined in:
lib/Test/Mini/Logger/TAP.pm

Overview

Default Test::Mini Output Logger.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Test::Mini::Logger

#begin_test_suite, #buffer, #count, #finish_test, #finish_test_case, #print, #say, #time, #verbose

Class Method Details

+ new($class, %args)



7
8
9
10
# File 'lib/Test/Mini/Logger/TAP.pm', line 7

sub new {
    my ($class, %args) = @_;
    return $class->SUPER::new(test_counter => 0, %args);
}

Instance Method Details

- begin_test($self)



34
35
36
37
# File 'lib/Test/Mini/Logger/TAP.pm', line 34

sub begin_test {
    my ($self) = @_;
    $self->inc_counter();
}

- begin_test_case($self, $tc, @tests)



29
30
31
32
# File 'lib/Test/Mini/Logger/TAP.pm', line 29

sub begin_test_case {
    my ($self, $tc, @tests) = @_;
    $self->diag("Test Case: $tc");
}

- diag($self, @msgs)



22
23
24
25
26
27
# File 'lib/Test/Mini/Logger/TAP.pm', line 22

sub diag {
    my ($self, @msgs) = @_;
    my $msg = join "\n", @msgs;
    $msg =~ s/^/# /mg;
    $self->say($msg);
}

- error($self, undef, $test, $msg)



50
51
52
53
54
# File 'lib/Test/Mini/Logger/TAP.pm', line 50

sub error {
    my ($self, undef, $test, $msg) = @_;
    $self->say("not ok @{[$self->test_counter]} - $test");
    $self->diag($msg);
}

- fail($self, undef, $test, $msg)



44
45
46
47
48
# File 'lib/Test/Mini/Logger/TAP.pm', line 44

sub fail {
    my ($self, undef, $test, $msg) = @_;
    $self->say("not ok @{[$self->test_counter]} - $test");
    $self->diag($msg);
}

- finish_test_suite($self)



68
69
70
71
# File 'lib/Test/Mini/Logger/TAP.pm', line 68

sub finish_test_suite {
    my ($self) = @_;
    $self->say("1..@{[$self->test_counter]}");
}

- inc_counter($self)



17
18
19
20
# File 'lib/Test/Mini/Logger/TAP.pm', line 17

sub inc_counter {
    my ($self) = @_;
    $self->{test_counter}++;
}

- pass($self, undef, $test)



39
40
41
42
# File 'lib/Test/Mini/Logger/TAP.pm', line 39

sub pass {
    my ($self, undef, $test) = @_;
    $self->say("ok @{[$self->test_counter]} - $test");
}

- skip($self, undef, $test, $msg)



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/Test/Mini/Logger/TAP.pm', line 56

sub skip {
    my ($self, undef, $test, $msg) = @_;
    $self->print("ok @{[$self->test_counter]} - $test # SKIP");

    if ($msg =~ /\n/) {
      $self->say();
      $self->diag($msg);
    } else {
      $self->say(": $msg");
    }
}

- test_counter($self)



12
13
14
15
# File 'lib/Test/Mini/Logger/TAP.pm', line 12

sub test_counter {
    my ($self) = @_;
    return $self->{test_counter};
}