line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Pcuke::Gherkin; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
93669
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
658
|
use Test::Pcuke::Gherkin::Parser; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
7
|
1
|
|
|
1
|
|
599
|
use Test::Pcuke::Gherkin::Lexer; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
165
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Test::Pcuke::Gherkin - roll your own cucumber |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.000001 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.000003'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This module compiles text in Gherkin to the executable AST. If you don't like |
25
|
|
|
|
|
|
|
L you can roll your own BDD cucumber-like tool! |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use Test::Pcuke::Gherkin; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $feature = Test::Pcuke::Gherkin->compile($content, $executor); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$feature->execute; |
32
|
|
|
|
|
|
|
... |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 compile $content, $executor |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
I<$content> is a text in Gherkin language. It should be decoded string, |
40
|
|
|
|
|
|
|
not octets, especially if the text is written in language other than english |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
I<$executor> is (optional) object, that has execute() method. |
43
|
|
|
|
|
|
|
If I<$executor> is not provided an internal and useless one is used to execute |
44
|
|
|
|
|
|
|
the steps. See 'ON EXECUTORS' below; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Returns L object (feature object) |
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub compile { |
50
|
0
|
|
|
0
|
1
|
|
my ($self, $content, $executor) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $tokens = Test::Pcuke::Gherkin::Lexer->scan( $content ); |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $parser = Test::Pcuke::Gherkin::Parser->new( { executor => $executor } ); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $parser->parse( $tokens ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; # End of Test::Pcuke::Gherkin |
61
|
|
|
|
|
|
|
__END__ |