1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!perl
use strict;
use warnings;
use Test::More;
use FindBin::libs;
use App::pherkin;
use Data::Dumper;
for my $test (
[
'Single tag: -t @cow',
['@cow'], [ and => [ or => 'cow' ] ]
],
[
'Two AND tags: -t @cow -t @blue',
['@cow','@blue'], [ and => [ or => 'cow' ], [ or => 'blue' ] ]
],
[
'Two OR tags: -t @cow,@blue',
['@cow,@blue'], [ and => [ or => 'cow', 'blue' ] ]
],
[
'Two OR, one AND: -t @cow,@blue -t @moo',
['@cow,@blue','@moo'], [ and => [ or => 'cow', 'blue' ], [ or => 'moo' ] ]
],
[
'Negated tag: -t ~@cow',
['~@cow'], [ and => [ or => [ not => 'cow' ] ] ]
],
[
'Negated with OR tag: -t ~@cow,@fish',
['~@cow,@fish'], [ and => [ or => [ not => 'cow' ], 'fish' ] ]
],
[
'Negated with AND tag: -t ~@cow -t @fish',
['~@cow','@fish'], [ and => [ or => [ not => 'cow' ] ], [ or => 'fish' ] ]
],
[
'Two negated: -t ~@cow,~@fish',
['~@cow,~@fish'], [ and => [ or => [ not => 'cow' ], [ not => 'fish' ] ] ]
],
) {
my ( $name, $tags, $result ) = @$test;
my $tag_out = App::pherkin->new()->_process_tags( @{$tags} );
is_deeply( $tag_out, $result, "Tags: $name" );
}
done_testing();
|