| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Modern::OpenAPI::Generator::CodeGen::Tests; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
58
|
use v5.26; |
|
|
6
|
|
|
|
|
38
|
|
|
4
|
6
|
|
|
6
|
|
25
|
use strict; |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
105
|
|
|
5
|
6
|
|
|
6
|
|
20
|
use warnings; |
|
|
6
|
|
|
|
|
8
|
|
|
|
6
|
|
|
|
|
233
|
|
|
6
|
6
|
|
|
6
|
|
55
|
use Carp qw(croak); |
|
|
6
|
|
|
|
|
7
|
|
|
|
6
|
|
|
|
|
2420
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub generate { |
|
9
|
4
|
|
|
4
|
1
|
28
|
my ( $class, %arg ) = @_; |
|
10
|
4
|
|
33
|
|
|
17
|
my $writer = $arg{writer} // croak 'writer'; |
|
11
|
4
|
|
33
|
|
|
13
|
my $base = $arg{base} // croak 'base'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
4
|
|
50
|
|
|
11
|
my $client = $arg{client} // 1; |
|
14
|
4
|
|
50
|
|
|
12
|
my $server = $arg{server} // 1; |
|
15
|
4
|
|
50
|
|
|
9
|
my $ui = $arg{ui} // 1; |
|
16
|
4
|
|
50
|
|
|
11
|
my $sync = $arg{sync} // 1; |
|
17
|
4
|
|
50
|
|
|
11
|
my $async = $arg{async} // 1; |
|
18
|
4
|
|
50
|
|
|
11
|
my $sigs = $arg{signatures} // []; |
|
19
|
4
|
|
50
|
|
|
11
|
my $ui_only = $arg{ui_only} // 0; |
|
20
|
4
|
|
50
|
|
|
10
|
my $local_test = $arg{local_test} // 0; |
|
21
|
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
7
|
my @use; |
|
23
|
4
|
100
|
|
|
|
15
|
push @use, "use_ok q($base\::Client::Core);" if $client; |
|
24
|
4
|
100
|
|
|
|
24
|
push @use, "use_ok q($base\::Client::Result);" if $client; |
|
25
|
4
|
100
|
|
|
|
12
|
push @use, "use_ok q($base\::Client::Ops);" if $client; |
|
26
|
4
|
100
|
66
|
|
|
19
|
push @use, "use_ok q($base\::Client::Sync);" if $client && $sync; |
|
27
|
4
|
100
|
66
|
|
|
28
|
push @use, "use_ok q($base\::Client::Async);" if $client && $async; |
|
28
|
4
|
50
|
33
|
|
|
36
|
push @use, "use_ok q($base\::Server);" if $server || $ui_only; |
|
29
|
4
|
50
|
33
|
|
|
21
|
push @use, "use_ok q($base\::Server::Controller);" if $server && !$ui_only; |
|
30
|
4
|
100
|
66
|
|
|
25
|
push @use, "use_ok q($base\::StubData);" if $server && $local_test && !$ui_only; |
|
|
|
|
66
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
11
|
for my $sig (@$sigs) { |
|
33
|
1
|
50
|
|
|
|
3
|
if ( $sig eq 'hmac' ) { |
|
|
|
0
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
2
|
push @use, "use_ok q($base\::Auth::Plugin::Hmac);"; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
elsif ( $sig eq 'bearer' ) { |
|
37
|
0
|
|
|
|
|
0
|
push @use, "use_ok q($base\::Auth::Plugin::Bearer);"; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
4
|
|
|
|
|
22
|
my $content; |
|
42
|
4
|
50
|
|
|
|
11
|
if (!@use) { |
|
43
|
0
|
|
|
|
|
0
|
$content = <<'T'; |
|
44
|
|
|
|
|
|
|
# Tests for generated modules (not for Modern::OpenAPI::Generator). |
|
45
|
|
|
|
|
|
|
use v5.26; |
|
46
|
|
|
|
|
|
|
use strict; |
|
47
|
|
|
|
|
|
|
use warnings; |
|
48
|
|
|
|
|
|
|
use Test::More; |
|
49
|
|
|
|
|
|
|
plan skip_all => 'no modules selected for this output (--no-client --no-server --no-ui)'; |
|
50
|
|
|
|
|
|
|
T |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
else { |
|
53
|
4
|
|
|
|
|
31
|
my $use_block = join "\n", @use; |
|
54
|
4
|
|
|
|
|
12
|
$content = <<"T"; |
|
55
|
|
|
|
|
|
|
# Tests for generated modules (not for Modern::OpenAPI::Generator). |
|
56
|
|
|
|
|
|
|
# From the generated project root: prove -l t |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use v5.26; |
|
59
|
|
|
|
|
|
|
use strict; |
|
60
|
|
|
|
|
|
|
use warnings; |
|
61
|
|
|
|
|
|
|
use Test::More; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
use FindBin qw(\$Bin); |
|
64
|
|
|
|
|
|
|
use File::Spec; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
BEGIN { |
|
67
|
|
|
|
|
|
|
unshift \@INC, File::Spec->catdir( \$Bin, File::Spec->updir, 'lib' ); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$use_block |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
done_testing; |
|
73
|
|
|
|
|
|
|
T |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
4
|
|
|
|
|
15
|
$writer->write( 't/00-load-generated.t', $content ); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |