From 586f5dfff413c4cecc0b66714f76aea8f609771c Mon Sep 17 00:00:00 2001 From: William Ricker Date: Sun, 7 Jun 2026 14:40:12 -0400 Subject: [PATCH 1/5] disable test with : on WIN --- t/naughty-filenames.t | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/naughty-filenames.t b/t/naughty-filenames.t index a0305ef8..862eb3f6 100644 --- a/t/naughty-filenames.t +++ b/t/naughty-filenames.t @@ -14,6 +14,10 @@ use Util; prep_environment(); +if ( is_windows() ) { + plan skip_all => 'Test fails on Windows.'; ## XXX TODO let the ones that dont fail run? +} + # Global: # /tmp/x/etc/.ackrc # /tmp/x/swamp From dc404e9e7982f5842427d8a5f71f6e2678093955 Mon Sep 17 00:00:00 2001 From: William Ricker Date: Sun, 7 Jun 2026 14:48:29 -0400 Subject: [PATCH 2/5] skip and exit test on Win --- t/naughty-filenames.t | 1 + 1 file changed, 1 insertion(+) diff --git a/t/naughty-filenames.t b/t/naughty-filenames.t index 862eb3f6..00adafd3 100644 --- a/t/naughty-filenames.t +++ b/t/naughty-filenames.t @@ -16,6 +16,7 @@ prep_environment(); if ( is_windows() ) { plan skip_all => 'Test fails on Windows.'; ## XXX TODO let the ones that dont fail run? + exit; } # Global: From bb260571b3788ad81b54ae6f13dc8fce56aeccc2 Mon Sep 17 00:00:00 2001 From: William Ricker Date: Sun, 7 Jun 2026 15:01:49 -0400 Subject: [PATCH 3/5] plan only once --- t/naughty-filenames.t | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/naughty-filenames.t b/t/naughty-filenames.t index 00adafd3..8ff225b2 100644 --- a/t/naughty-filenames.t +++ b/t/naughty-filenames.t @@ -4,7 +4,7 @@ use 5.010; use strict; use warnings; -use Test::More tests => 1; +use Test::More; use File::Spec (); use File::Temp (); @@ -18,6 +18,9 @@ if ( is_windows() ) { plan skip_all => 'Test fails on Windows.'; ## XXX TODO let the ones that dont fail run? exit; } +else { + plan tests => 1; +} # Global: # /tmp/x/etc/.ackrc From bb0f397731f1bb9eeadebe99261f9386f4ac9b2c Mon Sep 17 00:00:00 2001 From: William Ricker Date: Sun, 7 Jun 2026 15:22:54 -0400 Subject: [PATCH 4/5] let Win run RED test only --- t/naughty-filenames.t | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/t/naughty-filenames.t b/t/naughty-filenames.t index 8ff225b2..3abcf32e 100644 --- a/t/naughty-filenames.t +++ b/t/naughty-filenames.t @@ -4,7 +4,7 @@ use 5.010; use strict; use warnings; -use Test::More; +use Test::More tests => 1; use File::Spec (); use File::Temp (); @@ -14,14 +14,6 @@ use Util; prep_environment(); -if ( is_windows() ) { - plan skip_all => 'Test fails on Windows.'; ## XXX TODO let the ones that dont fail run? - exit; -} -else { - plan tests => 1; -} - # Global: # /tmp/x/etc/.ackrc # /tmp/x/swamp @@ -39,7 +31,7 @@ sub _test_naughty_ansi_filenames { local $Test::Builder::Level = $Test::Builder::Level + 1; return subtest subtest_name() => sub { - plan tests => 6; + plan tests => (is_windows() ? 4 : 6 ); my $base_obj = File::Temp->newdir; my $base = $base_obj->dirname; @@ -60,10 +52,15 @@ sub _test_naughty_ansi_filenames { # original bash equivalent: # # FORGED=$(printf 'real\nFORGED:999:injected_content.pl') # # printf 'foo\n' > "./$FORGED" + # This file name is illegal on Windows due to DOS2.0 A: B: C: disk names + # so skip this subtest on Windows. # - my $forged = "real\nFORGED:999:injected_content.pl"; - my $projectfile = File::Spec->catfile( $projectsubdir, $forged ); - write_file( $projectfile, "foo FORGED\n" ); + my $projectfile; + if (! is_windows()){ + my $forged = "real\nFORGED:999:injected_content.pl"; + $projectfile = File::Spec->catfile( $projectsubdir, $forged ); + write_file( $projectfile, "foo FORGED\n" ); + } # /tmp/x/project/subdir/${ansi} # ANSI injection: ESC bytes change terminal appearance @@ -83,12 +80,20 @@ sub _test_naughty_ansi_filenames { # TO VIEW temp dir contents # system('ls', '-alr', 'subdir',); + my @TestKeys; + if ( is_windows()){ + @TestKeys = (qw[ RED normal ]); # FORGED skipped on windows + } + else { + @TestKeys = (qw[ RED normal FORGED ]); + } + my %expect = ( RED => qr{\Qsubdir/file?[31mRED?[0m.pl\E}, normal => qr{\Qsubdir/normal.pl\E}, - FORGED => qr{\Qsubdir/real?FORGED:999:injected_content.pl\E}, + FORGED => qr{\Qsubdir/real?FORGED:999:injected_content.pl\E}, ## NOT ON WINDOWS ); - for my $name (qw[ RED normal FORGED ]){ + for my $name (@TestKeys){ subtest "5_01_filter_listing_$name" => sub { plan tests => 3; # /tmp/x/project/.ackrc @@ -109,14 +114,14 @@ sub _test_naughty_ansi_filenames { my %File = ( RED => qq{subdir/file\033\[31mRED\033\[0m.pl}, normal => qq{subdir/normal.pl}, - FORGED => qq{subdir/real\nFORGED:injected_content.pl}, + FORGED => qq{subdir/real\nFORGED:injected_content.pl}, ## NOT ON WINDOWS ); %expect = ( RED => qr{subdir/file[?][[]31mRED[?][[]0m[.]pl:1:foo}, normal => qr{subdir/normal.pl:1:foo}, - FORGED => qr{subdir/real[?]FORGED:999:injected_content[.]pl:1:foo}, + FORGED => qr{subdir/real[?]FORGED:999:injected_content[.]pl:1:foo}, ## NOT ON WINDOWS ); - for my $name (qw[ RED normal FORGED ]){ + for my $name (@TestKeys) { subtest "5_02_filter_match_$name" => sub { plan tests => 3; From c8d95f280ff517b2376874dc93bbb99cf5958261 Mon Sep 17 00:00:00 2001 From: William Ricker Date: Sun, 7 Jun 2026 15:30:54 -0400 Subject: [PATCH 5/5] skip whole test on WIN after all --- t/naughty-filenames.t | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/t/naughty-filenames.t b/t/naughty-filenames.t index 3abcf32e..8ff225b2 100644 --- a/t/naughty-filenames.t +++ b/t/naughty-filenames.t @@ -4,7 +4,7 @@ use 5.010; use strict; use warnings; -use Test::More tests => 1; +use Test::More; use File::Spec (); use File::Temp (); @@ -14,6 +14,14 @@ use Util; prep_environment(); +if ( is_windows() ) { + plan skip_all => 'Test fails on Windows.'; ## XXX TODO let the ones that dont fail run? + exit; +} +else { + plan tests => 1; +} + # Global: # /tmp/x/etc/.ackrc # /tmp/x/swamp @@ -31,7 +39,7 @@ sub _test_naughty_ansi_filenames { local $Test::Builder::Level = $Test::Builder::Level + 1; return subtest subtest_name() => sub { - plan tests => (is_windows() ? 4 : 6 ); + plan tests => 6; my $base_obj = File::Temp->newdir; my $base = $base_obj->dirname; @@ -52,15 +60,10 @@ sub _test_naughty_ansi_filenames { # original bash equivalent: # # FORGED=$(printf 'real\nFORGED:999:injected_content.pl') # # printf 'foo\n' > "./$FORGED" - # This file name is illegal on Windows due to DOS2.0 A: B: C: disk names - # so skip this subtest on Windows. # - my $projectfile; - if (! is_windows()){ - my $forged = "real\nFORGED:999:injected_content.pl"; - $projectfile = File::Spec->catfile( $projectsubdir, $forged ); - write_file( $projectfile, "foo FORGED\n" ); - } + my $forged = "real\nFORGED:999:injected_content.pl"; + my $projectfile = File::Spec->catfile( $projectsubdir, $forged ); + write_file( $projectfile, "foo FORGED\n" ); # /tmp/x/project/subdir/${ansi} # ANSI injection: ESC bytes change terminal appearance @@ -80,20 +83,12 @@ sub _test_naughty_ansi_filenames { # TO VIEW temp dir contents # system('ls', '-alr', 'subdir',); - my @TestKeys; - if ( is_windows()){ - @TestKeys = (qw[ RED normal ]); # FORGED skipped on windows - } - else { - @TestKeys = (qw[ RED normal FORGED ]); - } - my %expect = ( RED => qr{\Qsubdir/file?[31mRED?[0m.pl\E}, normal => qr{\Qsubdir/normal.pl\E}, - FORGED => qr{\Qsubdir/real?FORGED:999:injected_content.pl\E}, ## NOT ON WINDOWS + FORGED => qr{\Qsubdir/real?FORGED:999:injected_content.pl\E}, ); - for my $name (@TestKeys){ + for my $name (qw[ RED normal FORGED ]){ subtest "5_01_filter_listing_$name" => sub { plan tests => 3; # /tmp/x/project/.ackrc @@ -114,14 +109,14 @@ sub _test_naughty_ansi_filenames { my %File = ( RED => qq{subdir/file\033\[31mRED\033\[0m.pl}, normal => qq{subdir/normal.pl}, - FORGED => qq{subdir/real\nFORGED:injected_content.pl}, ## NOT ON WINDOWS + FORGED => qq{subdir/real\nFORGED:injected_content.pl}, ); %expect = ( RED => qr{subdir/file[?][[]31mRED[?][[]0m[.]pl:1:foo}, normal => qr{subdir/normal.pl:1:foo}, - FORGED => qr{subdir/real[?]FORGED:999:injected_content[.]pl:1:foo}, ## NOT ON WINDOWS + FORGED => qr{subdir/real[?]FORGED:999:injected_content[.]pl:1:foo}, ); - for my $name (@TestKeys) { + for my $name (qw[ RED normal FORGED ]){ subtest "5_02_filter_match_$name" => sub { plan tests => 3;