241220.1 · 89a3386bfa58afa368bc444c91e54655247de75d
Fix highlighting on --not
reading declarations
Changes to t/highlighting.t. All files
@@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 6;+use Test::More tests => 24; use lib 't'; use Util;@@ -23,13 +23,7 @@ BASIC: { {309}:"For the love of God, (Montresor)!" END - $expected_original = windows_slashify( $expected_original ) if is_windows;-- my @expected = colorize( $expected_original );-- my @results = run_ack( @args, @HIGHLIGHT );-- is_deeply( \@results, \@expected, 'Basic highlights match' );+ _check_it( $expected_original, @args, @HIGHLIGHT ); } @@ -47,13 +41,7 @@ METACHARACTERS: { {52}:"Though thy crest be shorn and shaven, thou," I said, "art sure no (craven), END - $expected_original = windows_slashify( $expected_original ) if is_windows;-- my @expected = colorize( $expected_original );-- my @results = run_ack( @args, @HIGHLIGHT );-- is_deeply( \@results, \@expected, 'Metacharacters match' );+ _check_it( $expected_original, @args, @HIGHLIGHT ); } @@ -81,11 +69,152 @@ CONTEXT: { {24}-by the people, for the people, shall not perish from the earth. END - $expected_original = windows_slashify( $expected_original ) if is_windows;+ _check_it( $expected_original, @args, @HIGHLIGHT );+}+++NOT: {+ ORIGINAL: {+ my @args = ( qw( judge -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House shall be the (Judge) of the Elections, Returns and Qualifications+(Judge)s of the supreme Court, and all other Officers of the United States,+shall (judge) necessary and expedient; he may, on extraordinary Occasions,+time ordain and establish. The (Judge)s, both of the supreme and inferior+the Land; and the (Judge)s in every State shall be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }++ NOT: {+ my @args = ( qw( judge --not judges -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House shall be the (Judge) of the Elections, Returns and Qualifications+shall (judge) necessary and expedient; he may, on extraordinary Occasions,+END++ _check_it( $expected_original, @args );+ }++ NOT_AGAIN: {+ my @args = ( qw( judge --not all -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+time ordain and establish. The (Judge)s, both of the supreme and inferior+END++ _check_it( $expected_original, @args );+ }+}+++AND: {+ ORIGINAL: {+ my @args = ( qw( judge -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House shall be the (Judge) of the Elections, Returns and Qualifications+(Judge)s of the supreme Court, and all other Officers of the United States,+shall (judge) necessary and expedient; he may, on extraordinary Occasions,+time ordain and establish. The (Judge)s, both of the supreme and inferior+the Land; and the (Judge)s in every State shall be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }++ AND: {+ my @args = ( qw( judge --and all -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House sh(all) be the (Judge) of the Elections, Returns and Qualifications+(Judge)s of the supreme Court, and (all) other Officers of the United States,+sh(all) (judge) necessary and expedient; he may, on extraordinary Occasions,+the Land; and the (Judge)s in every State sh(all) be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }++ AND_AND: {+ my @args = ( qw( judge --and all --and \bthe\b -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House sh(all) be (the) (Judge) of (the) Elections, Returns and Qualifications+(Judge)s of (the) supreme Court, and (all) other Officers of (the) United States,+(the) Land; and (the) (Judge)s in every State sh(all) be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }++}+++OR: {+ ORIGINAL: {+ my @args = ( qw( judges -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+(Judges) of the supreme Court, and all other Officers of the United States,+time ordain and establish. The (Judges), both of the supreme and inferior+the Land; and the (Judges) in every State shall be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }++ OR: {+ my @args = ( qw( judges --or judge -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House shall be the (Judge) of the Elections, Returns and Qualifications+(Judges) of the supreme Court, and all other Officers of the United States,+shall (judge) necessary and expedient; he may, on extraordinary Occasions,+time ordain and establish. The (Judges), both of the supreme and inferior+the Land; and the (Judges) in every State shall be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }++ OR_OR: {+ my @args = ( qw( judges --or judge --or amendment -i ), 't/text/constitution.txt' );++ my $expected_original = <<'END';+Each House shall be the (Judge) of the Elections, Returns and Qualifications+Representatives; but the Senate may propose or concur with (Amendment)s+(Judges) of the supreme Court, and all other Officers of the United States,+shall (judge) necessary and expedient; he may, on extraordinary Occasions,+time ordain and establish. The (Judges), both of the supreme and inferior+shall propose (Amendment)s to this Constitution, or, on the Application+Convention for proposing (Amendment)s, which, in either Case, shall be+Ratification may be proposed by the Congress; Provided that no (Amendment)+the Land; and the (Judges) in every State shall be bound thereby, any Thing+END++ _check_it( $expected_original, @args );+ }+}+++exit 0;+++sub _check_it {+ local $Test::Builder::Level = $Test::Builder::Level + 1;++ my $expected = shift;+ my @args = @_;++ $expected = windows_slashify( $expected ) if is_windows; - my @expected = colorize( $expected_original );+ my @expected = colorize( $expected ); my @results = run_ack( @args, @HIGHLIGHT ); - is_deeply( \@results, \@expected, 'Context is all good' );+ return is_deeply( \@results, \@expected, 'Context is all good' ); }