File: ack-column.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 (61 lines) | stat: -rw-r--r-- 1,691 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
52
53
54
55
56
57
58
59
60
61
#!perl -T

use warnings;
use strict;

use Test::More tests => 4;

use lib 't';
use Util;

prep_environment();

my $raven = reslash( 't/text/raven.txt' );
my @base_args = qw( nevermore -w -i --with-filename --noenv );

WITH_COLUMNS: {
    my @expected = line_split( <<'HERE' );
55:23:    Quoth the Raven, "Nevermore."
62:24:    With such name as "Nevermore."
69:26:    Then the bird said, "Nevermore."
76:18:    Of 'Never -- nevermore.'
83:24:    Meant in croaking "Nevermore."
90:26:    She shall press, ah, nevermore!
97:23:    Quoth the Raven, "Nevermore."
104:23:    Quoth the Raven, "Nevermore."
111:23:    Quoth the Raven, "Nevermore."
118:23:    Quoth the Raven, "Nevermore."
125:22:    Shall be lifted--nevermore!
HERE
    @expected = map { "${raven}:$_" } @expected;

    my @files = ( $raven );
    my @args = ( @base_args, '--column' );
    my @results = run_ack( @args, @files );

    lists_match( \@results, \@expected, 'Checking column numbers' );
}


WITHOUT_COLUMNS: {
    my @expected = line_split( <<'HERE' );
55:    Quoth the Raven, "Nevermore."
62:    With such name as "Nevermore."
69:    Then the bird said, "Nevermore."
76:    Of 'Never -- nevermore.'
83:    Meant in croaking "Nevermore."
90:    She shall press, ah, nevermore!
97:    Quoth the Raven, "Nevermore."
104:    Quoth the Raven, "Nevermore."
111:    Quoth the Raven, "Nevermore."
118:    Quoth the Raven, "Nevermore."
125:    Shall be lifted--nevermore!
HERE
    @expected = map { "${raven}:$_" } @expected;

    my @files = ( $raven );
    my @args = ( @base_args, '--no-column' );
    my @results = run_ack( @args, @files );

    lists_match( \@results, \@expected, 'Checking without column numbers' );
}