| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Routini; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26011
|
use 5.008001; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
45
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Test::More; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
1
|
|
|
1
|
|
273
|
use base 'Exporter'; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
434
|
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw(test run_me run_test); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#expose the test cache for testing purposes only |
|
9
|
|
|
|
|
|
|
our $test_cache; |
|
10
|
|
|
|
|
|
|
our $VERSION = 0.1; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub test { |
|
14
|
5
|
|
|
5
|
0
|
5901
|
my $name = shift; |
|
15
|
5
|
|
|
|
|
7
|
my $code = pop; |
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
21
|
$test_cache->{$name} = $code; |
|
18
|
|
|
|
|
|
|
}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub run_me { |
|
21
|
3
|
|
|
3
|
0
|
69
|
my $class = scalar(caller); |
|
22
|
3
|
|
|
|
|
11
|
my $instance = $class->new(); |
|
23
|
3
|
|
|
|
|
16
|
my $tests_run = 0; |
|
24
|
3
|
|
|
|
|
11
|
foreach my $test_name (keys %$test_cache) { |
|
25
|
4
|
|
|
|
|
25
|
$instance->run_test($test_name, $test_cache->{$test_name}); |
|
26
|
4
|
|
|
|
|
2450
|
$tests_run++; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
3
|
|
|
|
|
10
|
ok $tests_run > 0, 'tests run'; |
|
29
|
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub run_test { |
|
32
|
4
|
|
|
4
|
0
|
1679
|
my ($self, $name, $code) = @_; |
|
33
|
|
|
|
|
|
|
|
|
34
|
4
|
|
|
4
|
|
22
|
Test::More::subtest($name, sub { &{$code}($self) }); |
|
|
4
|
|
|
|
|
1868
|
|
|
|
4
|
|
|
|
|
11
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Test::Routini - A simple test framework primarialy for Moo/Mouse/Moose which provides a slice of the functionality of Test::Routine without the complexity of Moose |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use Moo; |
|
46
|
|
|
|
|
|
|
use Test::More; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use Test::Routini; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has foo => ( is => 'rw', default => sub { 'bar' } ); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
test "bob test" => sub { |
|
53
|
|
|
|
|
|
|
my $self = shift; |
|
54
|
|
|
|
|
|
|
print "running test\n"; |
|
55
|
|
|
|
|
|
|
ok 1; |
|
56
|
|
|
|
|
|
|
is $self->foo, 'bar'; |
|
57
|
|
|
|
|
|
|
}; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
before run_test => sub { |
|
60
|
|
|
|
|
|
|
print "running before each test!\n"; |
|
61
|
|
|
|
|
|
|
}; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
run_me; |
|
64
|
|
|
|
|
|
|
done_testing; |
|
65
|
|
|
|
|
|
|
1; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This module provides enough of the Test::Routine look and feel to make nice tests without the need for a MOP |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Aaron Moses Ezebardy@cpan.orgE |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Copyright 2013 Aaron Moses. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
80
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |