line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
18
|
|
|
18
|
|
257
|
use v5.14; |
|
18
|
|
|
|
|
68
|
|
2
|
18
|
|
|
18
|
|
97
|
use warnings; |
|
18
|
|
|
|
|
36
|
|
|
18
|
|
|
|
|
807
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::BDD::Cucumber::Model::Line 0.86; |
5
|
|
|
|
|
|
|
|
6
|
18
|
|
|
18
|
|
108
|
use Moo; |
|
18
|
|
|
|
|
44
|
|
|
18
|
|
|
|
|
177
|
|
7
|
18
|
|
|
18
|
|
6037
|
use Types::Standard qw( Int InstanceOf Str ); |
|
18
|
|
|
|
|
77
|
|
|
18
|
|
|
|
|
106
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Test::BDD::Cucumber::Model::Line - Model to represent a line in a feature file |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
version 0.86 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Model to represent a line in a feature file |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 number |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
The line number this line represents |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'number' => ( is => 'rw', isa => Int ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 document |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
The L object this line belongs to. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'document' => ( is => 'rw', isa => InstanceOf['Test::BDD::Cucumber::Model::Document'] ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 raw_content |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The content of the line, unmodified |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has 'raw_content' => ( is => 'rw', isa => Str ); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 indent |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Returns the number of preceding spaces before content on a line |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub indent { |
56
|
27
|
|
|
27
|
1
|
56
|
my $self = shift; |
57
|
27
|
|
|
|
|
489
|
my ($indent) = $self->raw_content =~ m/^( +)/g; |
58
|
27
|
|
100
|
|
|
373
|
return length( $indent || '' ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 content |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns the line's content, with the indentation stripped |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
5738
|
|
|
5738
|
1
|
94172
|
sub content { return _strip( $_[0]->raw_content ) } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 content_remove_indentation |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Accepts an int of number of spaces, and returns the content with exactly that |
72
|
|
|
|
|
|
|
many preceding spaces removed. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub content_remove_indentation { |
77
|
72
|
|
|
72
|
1
|
153
|
my ( $self, $indent ) = @_; |
78
|
72
|
|
|
|
|
172
|
$indent = ' ' x $indent; |
79
|
72
|
|
|
|
|
1162
|
my $content = $self->raw_content; |
80
|
72
|
|
|
|
|
764
|
$content =~ s/^$indent//; |
81
|
72
|
|
|
|
|
221
|
return $content; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 debug_summary |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Returns a string with the filename and line number |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub debug_summary { |
91
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
92
|
0
|
|
|
|
|
0
|
my $filename = $self->filename; |
93
|
|
|
|
|
|
|
return |
94
|
0
|
|
|
|
|
0
|
"Input: $filename line " |
95
|
|
|
|
|
|
|
. $self->number . ": [" |
96
|
|
|
|
|
|
|
. $self->raw_content . "]"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 filename |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns either the filename, or the string C<[String]> if the document was |
102
|
|
|
|
|
|
|
loaded from a string |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub filename { |
107
|
40
|
|
|
40
|
1
|
131
|
my $self = shift; |
108
|
40
|
50
|
|
|
|
623
|
$self->document->filename || '[String]'; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 is_blank |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 is_comment |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Return true if the line is either blank, or is a comment. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
913
|
|
|
913
|
1
|
1949
|
sub is_blank { return !( $_[0]->content =~ m/\S/ ) } |
120
|
1936
|
|
|
1936
|
1
|
7060
|
sub is_comment { return scalar $_[0]->content =~ m/^\s*#/ } |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub _strip { |
123
|
5738
|
|
|
5738
|
|
33268
|
my $string = shift; |
124
|
5738
|
|
|
|
|
17462
|
$string =~ s/^\s+//; |
125
|
5738
|
|
|
|
|
16728
|
$string =~ s/\s+$//; |
126
|
5738
|
|
|
|
|
24302
|
return $string; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 AUTHOR |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Peter Sergeant C |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 LICENSE |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Copyright 2019-2023, Erik Huelsmann |
136
|
|
|
|
|
|
|
Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |