From 9d80d0b7eb41b1c2957179a22cc5e3ca45dc75af Mon Sep 17 00:00:00 2001 From: Andy Lester Date: Thu, 28 Nov 2024 10:40:09 -0600 Subject: [PATCH] Starting on boolean tests for --not, which will become other booleans later. --- MANIFEST | 1 + t/boolean.t | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 t/boolean.t diff --git a/MANIFEST b/MANIFEST index faf8e687..8c28dc4c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -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 diff --git a/t/boolean.t b/t/boolean.t new file mode 100644 index 00000000..dfe5aef7 --- /dev/null +++ b/t/boolean.t @@ -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;