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