| 1 | package Test::Pcuke::Gherkin; | ||
| 2 | |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use Test::Pcuke::Gherkin::Parser; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Test::Pcuke::Gherkin::Lexer; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 1 | 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<Test::Pcuke> 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<Test::Pcuke::Gherkin::Node::Feature> object (feature object) | ||
| 47 | =cut | ||
| 48 | |||
| 49 | 0 | ▶ | sub compile { |
|
Subroutine
compile: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 50 | 0 | 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 | 1; # End of Test::Pcuke::Gherkin | |
| 61 | __END__ | ||