line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Prove; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
5652
|
use Mojo::Base 'Mojolicious::Plugin::Prove::Base'; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
54
|
|
6
|
7
|
|
|
7
|
|
903
|
use Mojo::File; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
2137
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 0.09; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub register { |
11
|
7
|
|
|
7
|
1
|
327
|
my ($self, $app, $conf) = @_; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
7
|
|
|
|
|
93
|
$self->add_template_path($app->renderer, __PACKAGE__); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
|
|
132
|
my $static_path = Mojo::File->new(__FILE__)->sibling('Prove', 'public' )->to_string; |
27
|
7
|
|
|
|
|
788
|
push @{ $app->static->paths }, $static_path; |
|
7
|
|
|
|
|
41
|
|
28
|
|
|
|
|
|
|
|
29
|
7
|
|
|
|
|
136
|
$app->plugin( 'PPI' => { no_check_file => 1 } ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
7
|
|
|
|
|
922860
|
my $r = $app->routes; |
33
|
7
|
100
|
|
|
|
121
|
$r = $conf->{route} if $conf->{route}; |
34
|
7
|
|
100
|
|
|
52
|
my $prefix = $conf->{prefix} // 'prove'; |
35
|
|
|
|
|
|
|
|
36
|
7
|
|
|
|
|
86
|
$self->prefix($prefix); |
37
|
7
|
|
100
|
|
|
153
|
$self->conf( $conf->{tests} || {} ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
41
|
7
|
|
|
|
|
43
|
my $pr = $r->route("/$prefix")->to( |
|
7
|
|
|
|
|
200
|
|
42
|
|
|
|
|
|
|
'controller#', |
43
|
|
|
|
|
|
|
namespace => 'Mojolicious::Plugin::Prove', |
44
|
|
|
|
|
|
|
plugin => $self, |
45
|
|
|
|
|
|
|
prefix => $self->prefix, |
46
|
|
|
|
|
|
|
conf => $self->conf, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
7
|
|
|
|
|
3180
|
$pr->get('/')->to( '#list' ); |
50
|
7
|
|
|
|
|
1717
|
$pr->get('/test/*name/file/*file/run')->to( '#run' ); |
51
|
7
|
|
|
|
|
2808
|
$pr->get('/test/*name/file/*file')->to( '#file' ); |
52
|
7
|
|
|
|
|
2780
|
$pr->get('/test/*name/run')->to( '#run' ); |
53
|
7
|
|
|
|
|
2348
|
$pr->get('/test/*name')->to( '#list' ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=pod |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=encoding UTF-8 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Mojolicious::Plugin::Prove - run test scripts via browser |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 VERSION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
version 0.09 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SYNOPSIS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Mojolicious::Lite |
76
|
|
|
|
|
|
|
plugin 'Prove' => { |
77
|
|
|
|
|
|
|
tests => { |
78
|
|
|
|
|
|
|
my_tests => '/path/to/test/files.t', |
79
|
|
|
|
|
|
|
}, |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Mojolicious |
83
|
|
|
|
|
|
|
$app->plugin( 'Prove' => { |
84
|
|
|
|
|
|
|
tests => { |
85
|
|
|
|
|
|
|
my_tests => '/path/to/test/files.t', |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
}); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Access |
90
|
|
|
|
|
|
|
http://localhost:3000/prove |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# Prefix |
93
|
|
|
|
|
|
|
plugin 'Prove' => { |
94
|
|
|
|
|
|
|
tests => { |
95
|
|
|
|
|
|
|
my_tests => '/path/to/test/files.t', |
96
|
|
|
|
|
|
|
}, |
97
|
|
|
|
|
|
|
prefix => 'tests', |
98
|
|
|
|
|
|
|
}; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Renee Baecker <reneeb@cpan.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Renee Baecker. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software, licensed under: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|