line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Prove; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
5128
|
use Mojo::Base 'Mojolicious::Plugin::Prove::Base'; |
|
8
|
|
|
|
|
64
|
|
|
8
|
|
|
|
|
52
|
|
6
|
8
|
|
|
8
|
|
887
|
use Mojo::File; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
2137
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 0.10; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub register { |
11
|
8
|
|
|
8
|
1
|
305
|
my ($self, $app, $conf) = @_; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
8
|
|
|
|
|
41
|
$self->add_template_path($app->renderer, __PACKAGE__); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
126
|
my $static_path = Mojo::File->new(__FILE__)->sibling('Prove', 'public' )->to_string; |
27
|
8
|
|
|
|
|
690
|
push @{ $app->static->paths }, $static_path; |
|
8
|
|
|
|
|
42
|
|
28
|
|
|
|
|
|
|
|
29
|
8
|
|
|
|
|
127
|
$app->plugin( 'PPI' => { no_check_file => 1 } ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
8
|
|
|
|
|
883813
|
my $r = $app->routes; |
33
|
8
|
100
|
|
|
|
95
|
$r = $conf->{route} if $conf->{route}; |
34
|
8
|
|
100
|
|
|
59
|
my $prefix = $conf->{prefix} // 'prove'; |
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
|
|
83
|
$self->prefix($prefix); |
37
|
8
|
|
100
|
|
|
130
|
$self->conf( $conf->{tests} || {} ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
41
|
8
|
|
|
|
|
54
|
my $pr = $r->route("/$prefix")->to( |
|
8
|
|
|
|
|
203
|
|
42
|
|
|
|
|
|
|
'controller#', |
43
|
|
|
|
|
|
|
namespace => 'Mojolicious::Plugin::Prove', |
44
|
|
|
|
|
|
|
plugin => $self, |
45
|
|
|
|
|
|
|
prefix => $self->prefix, |
46
|
|
|
|
|
|
|
conf => $self->conf, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
8
|
|
|
|
|
3000
|
$pr->get('/')->to( '#list' )->name('mpp_prove_list'); |
50
|
8
|
|
|
|
|
1669
|
$pr->get('/test/*name/file/*file/run')->to( '#run' )->name('mpp_run_file'); |
51
|
8
|
|
|
|
|
2819
|
$pr->get('/test/*name/file/*file')->to( '#file' )->name('mpp_file'); |
52
|
8
|
|
|
|
|
2552
|
$pr->get('/test/*name/run')->to( '#run' )->name('mpp_run_all'); |
53
|
8
|
|
|
|
|
2325
|
$pr->get('/test/*name')->to( '#list' )->name('mpp_file_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.1 |
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
|
|
|
|
|
|
|
|