Skip to content

Commit

Permalink
First draft of movies tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Sep 29, 2024
1 parent 7c6614b commit ce39dbc
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 1 deletion.
51 changes: 51 additions & 0 deletions t/ack-boolean.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!perl

use warnings;
use strict;
use experimental 'signatures';

use Test::More tests => 4;


use lib 't';
use Util;

prep_environment();


NOT: {
_movies_are(
[qw( Murray )],
[
'Caddyshack',
'Ghostbusters',
'Groundhog Day',
'Little Shop of Horrors',
'Stripes',
]
);

_movies_are(
[qw( Murray --not Ramis )],
[
'Caddyshack',
'Groundhog Day',
'Little Shop of Horrors',
]
);
}


done_testing();
exit 0;


sub _movies_are( $args, $exp ) {
my @base_args = qw( -w -i --noenv );
my @files = ( reslash( 't/text/movies.txt' ) );
my @got = run_ack( @base_args, @{$args}, @files );

s/:.+// for @got;

is_deeply( \@got, $exp, join( ' ', @{$args} ) );
}
2 changes: 2 additions & 0 deletions t/ack-c.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DASH_C: {
t/text/bill-of-rights.txt:0
t/text/constitution.txt:0
t/text/gettysburg.txt:1
t/text/movies.txt:0
t/text/number.txt:0
t/text/numbered-text.txt:0
t/text/ozymandias.txt:0
Expand All @@ -38,6 +39,7 @@ WITH_DASH_V: {
t/text/bill-of-rights.txt:45
t/text/constitution.txt:259
t/text/gettysburg.txt:15
t/text/movies.txt:25
t/text/number.txt:1
t/text/numbered-text.txt:20
t/text/ozymandias.txt:9
Expand Down
4 changes: 4 additions & 0 deletions t/ack-g.t
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ subtest '-v works on -g' => sub {
my @expected = qw(
t/text/bill-of-rights.txt
t/text/gettysburg.txt
t/text/movies.txt
);
my $file_regex = 'n';

Expand Down Expand Up @@ -291,6 +292,7 @@ subtest 'test -g on a path' => sub {
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/gettysburg.txt
t/text/movies.txt
t/text/number.txt
t/text/numbered-text.txt
t/text/ozymandias.txt
Expand All @@ -311,6 +313,7 @@ t/(text)/amontillado.txt
t/(text)/bill-of-rights.txt
t/(text)/constitution.txt
t/(text)/gettysburg.txt
t/(text)/movies.txt
t/(text)/number.txt
t/(text)/numbered-(text).txt
t/(text)/ozymandias.txt
Expand Down Expand Up @@ -343,6 +346,7 @@ t/text/amontillado.txt
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/gettysburg.txt
t/text/movies.txt
t/text/number.txt
t/text/numbered-text.txt
t/text/ozymandias.txt
Expand Down
3 changes: 3 additions & 0 deletions t/ack-l.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ my @matching = qw(
my @nonmatching = qw(
t/text/amontillado.txt
t/text/gettysburg.txt
t/text/movies.txt
t/text/number.txt
t/text/numbered-text.txt
t/text/ozymandias.txt
Expand Down Expand Up @@ -59,6 +60,7 @@ DASH_CAPITAL_L: {
my @expected = qw(
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/movies.txt
t/text/number.txt
t/text/numbered-text.txt
t/text/ozymandias.txt
Expand All @@ -83,6 +85,7 @@ DASH_LV: {
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/gettysburg.txt
t/text/movies.txt
t/text/number.txt
t/text/numbered-text.txt
t/text/ozymandias.txt
Expand Down
2 changes: 2 additions & 0 deletions t/ack-print0.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ G_NO_PRINT0: {
t/text/amontillado.txt
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/movies.txt
t/text/ozymandias.txt
);

Expand All @@ -32,6 +33,7 @@ G_PRINT0: {
t/text/amontillado.txt
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/movies.txt
t/text/ozymandias.txt
) ) . "\0"; # string of filenames separated and concluded with null byte

Expand Down
1 change: 0 additions & 1 deletion movies.txt → t/text/movies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Elf: Asner, Caan, Deschanel, Ferrell, Newhart, Steenburgen
Ghostbusters: Aykroyd, Murray, Moranis, Ramis
Groundhog Day: Elliott, Murray
Little Shop of Horrors: Guest, Martin, Moranis, Murray
A Mighty Wind: Guest, Levy, Lynch, O'Hara, Shearer, Willard
My Blue Heaven: Martin, Moranis
Neighbors: Aykroyd, Belushi
Parenthood: Martin, Steenburgen
Expand Down
1 change: 1 addition & 0 deletions t/trailing-whitespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ t/text/amontillado.txt
t/text/bill-of-rights.txt
t/text/constitution.txt
t/text/gettysburg.txt
t/text/movies.txt
t/text/number.txt
t/text/numbered-text.txt
t/text/ozymandias.txt
Expand Down

0 comments on commit ce39dbc

Please sign in to comment.