| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package KiokuDB::Test; |
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
128074
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
82
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
69
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
10
|
use Scalar::Util qw(blessed); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
175
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Test::More; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
1859
|
use Module::Pluggable::Object; |
|
|
2
|
|
|
|
|
14630
|
|
|
|
2
|
|
|
|
|
71
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
446
|
use namespace::clean; |
|
|
2
|
|
|
|
|
13193
|
|
|
|
2
|
|
|
|
|
16
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
24
|
use Sub::Exporter -setup => { |
|
16
|
|
|
|
|
|
|
exports => [qw(run_all_fixtures)], |
|
17
|
|
|
|
|
|
|
groups => { default => [-all] }, |
|
18
|
2
|
|
|
2
|
|
1450
|
}; |
|
|
2
|
|
|
|
|
9903
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $mp = Module::Pluggable::Object->new( |
|
21
|
|
|
|
|
|
|
search_path => "KiokuDB::Test::Fixture", |
|
22
|
|
|
|
|
|
|
require => 1, |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my @fixtures = sort { $a->sort <=> $b->sort } $mp->plugins; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub run_all_fixtures { |
|
28
|
33
|
|
|
33
|
1
|
71
|
my ( $with ) = @_; |
|
29
|
|
|
|
|
|
|
|
|
30
|
33
|
50
|
|
561
|
|
263
|
my $get_dir = blessed($with) ? sub { $with } : $with; |
|
|
561
|
|
|
|
|
15736
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
33
|
|
50
|
|
|
226
|
for ( 1 .. ( $ENV{KIOKUDB_REPEAT_FIXTURES} || 1 ) ) { |
|
33
|
33
|
50
|
0
|
|
|
118
|
require List::Util and @fixtures = List::Util::shuffle(@fixtures) if $ENV{KIOKUDB_SHUFFLE_FIXTURES}; |
|
34
|
33
|
|
|
|
|
70
|
foreach my $fixture ( @fixtures ) { |
|
35
|
594
|
50
|
33
|
|
|
26947
|
next if $ENV{KIOKUDB_FIXTURE} and $fixture->name ne $ENV{KIOKUDB_FIXTURE}; |
|
36
|
594
|
|
|
|
|
16670
|
$fixture->new( get_directory => $get_dir )->run; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__PACKAGE__ |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
KiokuDB::Test - Reusable tests for L<KiokuDB> backend authors. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use Test::More; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use KiokuDB::Test; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use ok "KiokuDB::Backend::MySpecialBackend"; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $b = KiokuDB::Backend::MySpecialBackend->new( ... ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
run_all_fixtures( KiokuDB->new( backend => $b ) ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
done_testing(); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This module loads and runs L<KiokuDB::Test::Fixture>s against a L<KiokuDB> |
|
66
|
|
|
|
|
|
|
directory instance. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 EXPORTS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item run_all_fixtures $dir |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item run_all_fixtures sub { return $dir } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Runs all the L<KiokuDB::Test::Fixture> objects against your dir. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
If you need a new instance of L<KiokuDB> for every fixture, pass in a code |
|
79
|
|
|
|
|
|
|
reference. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This will load all the modules in the L<KiokuDB::Test::Fixture> namespace, and |
|
82
|
|
|
|
|
|
|
run them against your directory. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Fixtures generally check for backend roles and skip unless the backend supports |
|
85
|
|
|
|
|
|
|
that set of features. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |