line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
103271
|
use v5.14; |
|
7
|
|
|
|
|
38
|
|
2
|
7
|
|
|
7
|
|
46
|
use warnings; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
371
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::BDD::Cucumber::Loader 0.86; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::BDD::Cucumber::Loader - Simplify loading of Step Definition and feature files |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 0.86 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Makes loading Step Definition files and Feature files a breeze... |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 METHODS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 load |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Accepts a path, and returns a L object with the Step |
23
|
|
|
|
|
|
|
Definition files loaded, and a list of L objects. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 load_steps |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Accepts an L object and a string representing either a |
28
|
|
|
|
|
|
|
step file, or a directory containing zero or more C<*_steps.pl> files, and loads |
29
|
|
|
|
|
|
|
the steps in to the executor; if you've used C we'll have already scanned |
30
|
|
|
|
|
|
|
the feature directory for C<*_steps.pl> files. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
7
|
|
472
|
use Path::Class; |
|
7
|
|
|
|
|
40033
|
|
|
7
|
|
|
|
|
381
|
|
36
|
7
|
|
|
7
|
|
3491
|
use File::Find::Rule; |
|
7
|
|
|
|
|
52425
|
|
|
7
|
|
|
|
|
66
|
|
37
|
|
|
|
|
|
|
|
38
|
7
|
|
|
7
|
|
3360
|
use Test::BDD::Cucumber::Executor; |
|
7
|
|
|
|
|
28
|
|
|
7
|
|
|
|
|
318
|
|
39
|
7
|
|
|
7
|
|
3484
|
use Test::BDD::Cucumber::Parser; |
|
7
|
|
|
|
|
167
|
|
|
7
|
|
|
|
|
295
|
|
40
|
7
|
|
|
7
|
|
178
|
use Test::BDD::Cucumber::StepFile(); |
|
7
|
|
|
|
|
23
|
|
|
7
|
|
|
|
|
1979
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub load { |
43
|
12
|
|
|
12
|
1
|
1387
|
my ( $class, $path ) = @_; |
44
|
|
|
|
|
|
|
|
45
|
12
|
|
|
|
|
248
|
my $executor = Test::BDD::Cucumber::Executor->new(); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Either load a feature or a directory... |
48
|
12
|
|
|
|
|
313
|
my ( $dir, $file ); |
49
|
12
|
100
|
|
|
|
341
|
if ( -f $path ) { |
50
|
4
|
|
|
|
|
25
|
$file = file($path); |
51
|
4
|
|
|
|
|
413
|
$dir = $file->dir; |
52
|
|
|
|
|
|
|
} else { |
53
|
8
|
|
|
|
|
164
|
$dir = dir($path); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Load up the steps |
57
|
12
|
|
|
|
|
835
|
$class->load_steps( $executor, $dir ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Grab the feature files |
60
|
|
|
|
|
|
|
my @features = map { |
61
|
12
|
100
|
|
|
|
298
|
my $file = file($_); |
|
17
|
|
|
|
|
14374
|
|
62
|
17
|
|
|
|
|
2077
|
my $feature = |
63
|
|
|
|
|
|
|
Test::BDD::Cucumber::Parser->parse_file( $file ); |
64
|
|
|
|
|
|
|
} ( |
65
|
|
|
|
|
|
|
$file |
66
|
|
|
|
|
|
|
? ( $file . '' ) |
67
|
|
|
|
|
|
|
: File::Find::Rule->file()->name('*.feature')->in($dir) |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
12
|
|
|
|
|
156
|
return ( $executor, @features ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub load_steps { |
74
|
12
|
|
|
12
|
1
|
47
|
my ( $class, $executor, $path ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
12
|
50
|
|
|
|
250
|
if ( -f $path ) { |
77
|
0
|
|
|
|
|
0
|
$executor->add_steps( Test::BDD::Cucumber::StepFile->load($path) ); |
78
|
|
|
|
|
|
|
} else { |
79
|
|
|
|
|
|
|
$executor->add_steps( Test::BDD::Cucumber::StepFile->load($_) ) |
80
|
12
|
|
|
|
|
922
|
for File::Find::Rule->file()->name('*_steps.pl')->in($path); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
12
|
|
|
|
|
142
|
return $class; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Peter Sergeant C |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 LICENSE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Copyright 2019-2023, Erik Huelsmann |
93
|
|
|
|
|
|
|
Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |