@ 11d698f

191204.1 · 5e985fbe449f62f05a94f57ce0f296734d3d7920

Add more test cases

reading declarations

Changes to t/ack-files-from.t. All files

t/ack-files-from.t

@@ -4,13 +4,23 @@ use strict; use warnings; use lib 't'; -use Test::More tests => 3;+use Test::More tests => 6;  use Util;  prep_environment();  +my @textfiles = qw(+    t/text/amontillado.txt+    t/text/bill-of-rights.txt+    t/text/constitution.txt+    t/text/gettysburg.txt+    t/text/ozymandias.txt+    t/text/raven.txt+);++ subtest 'Basic reading from files, no switches' => sub {     plan tests => 1; @@ -53,6 +63,55 @@ subtest 'Source file exists, but non-existent files mentioned in the file' => su     like( $stderr->[0], qr/file-that-isnt-there: No such file/, 'Correct warning message for non-existent file' ); }; ++subtest '-l and --files-from' => sub {+    plan tests => 1;++    my $tempfile = create_tempfile( @textfiles );++    my @expected = qw(+        t/text/amontillado.txt+        t/text/gettysburg.txt+        t/text/raven.txt+    );++    ack_sets_match( [ '--files-from=' . $tempfile->filename, 'God', '-l' ], \@expected, 'Looking for God files' );+};+++subtest '-L and --files-from' => sub {+    plan tests => 1;++    my $tempfile = create_tempfile( @textfiles );++    my @expected = qw(+        t/text/bill-of-rights.txt+        t/text/constitution.txt+        t/text/ozymandias.txt+    );++    ack_sets_match( [ '--files-from=' . $tempfile->filename, 'God', '-L' ], \@expected, 'Looking for absence of God' );+};+++subtest '-c and --files-from' => sub {+    plan tests => 1;++    my $tempfile = create_tempfile( @textfiles );++    my @expected = qw(+        t/text/amontillado.txt:2+        t/text/bill-of-rights.txt:0+        t/text/constitution.txt:0+        t/text/gettysburg.txt:1+        t/text/ozymandias.txt:0+        t/text/raven.txt:2+    );++    ack_sets_match( [ '--files-from=' . $tempfile->filename, 'God', '-c' ], \@expected, 'Looking for God files' );+};++ done_testing();  exit 0;