File: 700_tag_processing.t

package info (click to toggle)
libtest-bdd-cucumber-perl 0.26-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 528 kB
  • sloc: perl: 3,436; makefile: 8
file content (51 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download
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();