File: ack-help-types.t

package info (click to toggle)
ack 2.24-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,704 kB
  • sloc: perl: 8,590; ansic: 21; fortran: 11; makefile: 5; sh: 5
file content (39 lines) | stat: -rw-r--r-- 775 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
#!perl -T

use strict;
use warnings;

use List::Util qw(sum);
use Test::More;

use lib 't';
use Util;

prep_environment();

my @types = (
    perl   => [qw{.pl .pod .pl .t}],
    python => [qw{.py}],
    ruby   => [qw{.rb Rakefile}],
);

my @options = qw(
    --help-types
    --help=types
);

plan tests => 12;

foreach my $option ( @options ) {
    my @output = run_ack($option);

    while ( my ($type,$checks) = splice( @types, 0, 2 ) ) {
        my ( $matching_line ) = grep { /--\[no\]$type/ } @output;

        ok( $matching_line, "A match should be found for --$type in the output for $option" );

        foreach my $check (@{$checks}) {
            like( $matching_line, qr/\Q$check\E/, "Line for --$type in output for $option contains $check" );
        }
    }
}