Skip to content

Commit

Permalink
Starting on boolean tests for --not, which will become other booleans…
Browse files Browse the repository at this point in the history
… later.
  • Loading branch information
petdance committed Nov 28, 2024
1 parent 8ca1a50 commit 9d80d0b
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ t/ack-x.t
t/anchored.t
t/bad-ackrc-opt.t
t/basic.t
t/boolean.t
t/command-line-files.t
t/config-backwards-compat.t
t/config-finder.t
Expand Down
88 changes: 88 additions & 0 deletions t/boolean.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!perl

use warnings;
use strict;
use 5.010;

use Test::More;

use lib 't';
use Util;

plan tests => 4;

prep_environment();

NO_BOOLEANS: {
my @expected = line_split( <<'HERE' );
Quoth the Raven, "Nevermore."
With such name as "Nevermore."
Then the bird said, "Nevermore."
Of 'Never -- nevermore.'
Meant in croaking "Nevermore."
She shall press, ah, nevermore!
Quoth the Raven, "Nevermore."
Quoth the Raven, "Nevermore."
Quoth the Raven, "Nevermore."
Quoth the Raven, "Nevermore."
Shall be lifted--nevermore!
HERE

my @files = qw( t/text/raven.txt );

my @args = qw( -i nevermore );

ack_sets_match( [ @args, @files ], \@expected, 'No booleans' );
}


NEVERMORE_NOT_QUOTH: {
my @expected = line_split( <<'HERE' );
With such name as "Nevermore."
Then the bird said, "Nevermore."
Of 'Never -- nevermore.'
Meant in croaking "Nevermore."
She shall press, ah, nevermore!
Shall be lifted--nevermore!
HERE

my @files = qw( t/text/raven.txt );

my @args = qw( -i nevermore --not quoth );

ack_sets_match( [ @args, @files ], \@expected, 'Nevermore not quoth' );
}


NEVERMORE_NOT_QUOTH_NOT_THE: {
my @expected = line_split( <<'HERE' );
With such name as "Nevermore."
Of 'Never -- nevermore.'
Meant in croaking "Nevermore."
She shall press, ah, nevermore!
Shall be lifted--nevermore!
HERE

my @files = qw( t/text/raven.txt );

my @args = qw( -i nevermore --not quoth --not the );

ack_sets_match( [ @args, @files ], \@expected, 'Nevermore not quoth not the' );
}


QUOTH_NOT_NEVERMORE: {
my @expected = line_split( <<'HERE' );
HERE

my @files = qw( t/text/raven.txt );

my @args = qw( -i quoth --not nevermore );

ack_sets_match( [ @args, @files ], \@expected, 'Quoth not nevermore' );
}


done_testing();

exit 0;

0 comments on commit 9d80d0b

Please sign in to comment.