| 1 | { | ||
| 2 | package OOP::Perlish::Class::UnitTests::TestEmit; | ||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Test::Class; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Test::More; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use OOP::Perlish::Class::UnitTests::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use base qw(OOP::Perlish::Class::UnitTests::Base); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 7 | ▶ | sub setup : Test(setup) |
|
Subroutine
setup: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 11 | { | ||
| 12 | 7 | my ($self) = @_; | |
| 13 | |||
| 14 | 7 | $self->{obj} = OOP::Perlish::Class::UnitTests::Baz::Foo::Bar->new( bar => 'bar' ); | |
| 15 | |||
| 16 | 7 | $self->{obj}->_emitlevel(9); | |
| 17 | 7 | $self->{string} = ''; | |
| 18 | |||
| 19 | 7 | close STDERR; | |
| 20 | 7 | open(STDERR, '>', \$self->{string} ); | |
| 21 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | sub test_emit | ||
| 24 | 6 | ▶ | { |
|
Subroutine
test_emit: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 25 | 6 | my ($self, $level) = @_; | |
| 26 | |||
| 27 | 6 | $self->{obj}->$level('Hello world ' . $level); | |
| 28 | 6 | is($self->{string}, uc($level) . ': ' . 'Hello world ' . $level . $/, $level . ' output correctly'); | |
| 29 | } | ||
| 30 | |||
| 31 | 1 | ▶ | sub testerror : Test(1) |
|
Subroutine
testerror: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 32 | { | ||
| 33 | 1 | my ($self) = @_; | |
| 34 | 1 | $self->test_emit('error'); | |
| 35 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | 1 | ▶ | sub testwarning : Test(1) |
|
Subroutine
testwarning: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 38 | { | ||
| 39 | 1 | my ($self) = @_; | |
| 40 | 1 | $self->test_emit('warning'); | |
| 41 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | 1 | ▶ | sub testinfo : Test(1) |
|
Subroutine
testinfo: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 44 | { | ||
| 45 | 1 | my ($self) = @_; | |
| 46 | 1 | $self->test_emit('info'); | |
| 47 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | |||
| 49 | 1 | ▶ | sub testverbose : Test(1) |
|
Subroutine
testverbose: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 50 | { | ||
| 51 | 1 | my ($self) = @_; | |
| 52 | 1 | $self->test_emit('verbose'); | |
| 53 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 54 | |||
| 55 | 1 | ▶ | sub testdebug : Test(1) |
|
Subroutine
testdebug: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 56 | { | ||
| 57 | 1 | my ($self) = @_; | |
| 58 | |||
| 59 | 1 | $self->{obj}->debug('Hello world debug'); | |
| 60 | 1 | is($self->{string}, 'DEBUG0: ' . 'Hello world debug' . $/, 'debug output correctly'); | |
| 61 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 62 | |||
| 63 | 1 | ▶ | sub testdebug1 : Test(1) |
|
Subroutine
testdebug1: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 64 | { | ||
| 65 | 1 | my ($self) = @_; | |
| 66 | 1 | $self->test_emit('debug1'); | |
| 67 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 68 | |||
| 69 | 1 | ▶ | sub testdebug2 : Test(1) |
|
Subroutine
testdebug2: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 70 | { | ||
| 71 | 1 | my ($self) = @_; | |
| 72 | 1 | $self->test_emit('debug2'); | |
| 73 | 1 | ▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 74 | } | ||
| 75 | 1 | 1; | |
| 76 | =head1 NAME | ||
| 77 | |||
| 78 | =head1 VERSION | ||
| 79 | |||
| 80 | =head1 SYNOPSIS | ||
| 81 | |||
| 82 | =head1 METHODS | ||
| 83 | |||
| 84 | =head1 AUTHOR | ||
| 85 | |||
| 86 | Jamie Beverly, C<< <jbeverly at cpan.org> >> | ||
| 87 | |||
| 88 | =head1 BUGS | ||
| 89 | |||
| 90 | Please report any bugs or feature requests to C<bug-foo-bar at rt.cpan.org>, | ||
| 91 | or through | ||
| 92 | the web interface at | ||
| 93 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=OOP-Perlish-Class>. I will be | ||
| 94 | notified, and then you'll | ||
| 95 | automatically be notified of progress on your bug as I make changes. | ||
| 96 | |||
| 97 | =head1 SUPPORT | ||
| 98 | |||
| 99 | You can find documentation for this module with the perldoc command. | ||
| 100 | |||
| 101 | perldoc OOP::Perlish::Class | ||
| 102 | |||
| 103 | |||
| 104 | You can also look for information at: | ||
| 105 | |||
| 106 | =over 4 | ||
| 107 | |||
| 108 | =item * RT: CPAN's request tracker | ||
| 109 | |||
| 110 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=OOP-Perlish-Class> | ||
| 111 | |||
| 112 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 113 | |||
| 114 | L<http://annocpan.org/dist/OOP-Perlish-Class> | ||
| 115 | |||
| 116 | =item * CPAN Ratings | ||
| 117 | |||
| 118 | L<http://cpanratings.perl.org/d/OOP-Perlish-Class> | ||
| 119 | |||
| 120 | =item * Search CPAN | ||
| 121 | |||
| 122 | L<http://search.cpan.org/dist/OOP-Perlish-Class/> | ||
| 123 | |||
| 124 | =back | ||
| 125 | |||
| 126 | |||
| 127 | =head1 ACKNOWLEDGEMENTS | ||
| 128 | |||
| 129 | =head1 COPYRIGHT & LICENSE | ||
| 130 | |||
| 131 | Copyright 2009 Jamie Beverly | ||
| 132 | |||
| 133 | This program is free software; you can redistribute it and/or modify it | ||
| 134 | under the terms of either: the GNU General Public License as published | ||
| 135 | by the Free Software Foundation; or the Artistic License. | ||
| 136 | |||
| 137 | See http://dev.perl.org/licenses/ for more information. | ||
| 138 | |||
| 139 | =cut | ||