| 1 | package Test::Sweet::Runnable; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | $Test::Sweet::Runnable::VERSION = '0.03'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: C<MooseX::Runnable> support for Test::Sweet classes | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Test::More; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | with 'MooseX::Runnable'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | require MooseX::Getopt; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | with 'MooseX::Getopt'; | |||||||||||||||||||||||||||||||||||||||||
| 17 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=1 SCAR=3.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | my @tests = $self->meta->get_all_tests; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | plan tests => scalar @tests; # so you get a "progress bar" | |||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | try { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | $self->$_ for @tests; | |||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | catch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | if( blessed $_ && $_->can('does') && $_->does('Test::Sweet::Exception') ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
builtin::blessed($_) and $_->can("does") and $_->does("Test::Sweet::Exception")
builtin::blessed($_) and $_->can("does")
MC/DC0%0/3
builtin::blessed($_) and $_->can("does") and $_->does("Test::Sweet::Exception")
builtin::blessed($_)
$_->can("does")
$_->does("Test::Sweet::Exception")
Truth table0%0/4
A and B and C
A= builtin::blessed($_)B= $_->can("does")C= $_->does("Test::Sweet::Exception")
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | diag "Test '". $_->method. "' in '". $_->class. "' failed". ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | $_->isa('Test::Sweet::Exception::FailedMethod') ? | ||||||||||||||||||||||||||||||||||||||||||
| 30 | ' by throwing an exception' : | ||||||||||||||||||||||||||||||||||||||||||
| 31 | $_->isa('Test::Sweet::Exception::FailedMetatestConstruction') ? | ||||||||||||||||||||||||||||||||||||||||||
| 32 | ' with an error in the metatest constructor' : | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ''). ": ". $_->error; | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | diag "Test died: $_"; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | die $_; # rethrow for the "harness" | |||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | Test::Sweet::Runnable - C<MooseX::Runnable> support for Test::Sweet classes | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | version 0.03 | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | Jonathan Rockway <jrockway@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | This software is copyright (c) 2011 by Jonathan Rockway. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 67 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | __END__ | ||||||||||||||||||||||||||||||||||||||||||