From eaf344cfb4d1b692a8cf1e50268eb28646588d2d Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Sat, 24 Dec 2022 16:18:23 +0100 Subject: [PATCH] ext/FileCache/t/ - fixup paralleism issues in tests Different test files used the same files for their tests, causing conflicts and test failures in parallel mode. --- ext/FileCache/t/01open.t | 2 +- ext/FileCache/t/02maxopen.t | 6 +++--- ext/FileCache/t/03append.t | 2 +- ext/FileCache/t/04twoarg.t | 16 ++++++++-------- ext/FileCache/t/05override.t | 4 ++-- ext/FileCache/t/07noimport.t | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ext/FileCache/t/01open.t b/ext/FileCache/t/01open.t index c01b25a..c6d0c6b 100644 --- a/ext/FileCache/t/01open.t +++ b/ext/FileCache/t/01open.t @@ -3,7 +3,7 @@ use FileCache; our @files; -BEGIN { @files = qw(foo bar baz quux Foo_Bar) } +BEGIN { @files = map { "open_$_" } qw(foo bar baz quux Foo_Bar) } END { 1 while unlink @files } use Test::More tests => 1; diff --git a/ext/FileCache/t/02maxopen.t b/ext/FileCache/t/02maxopen.t index f3470c1..4a01056 100644 --- a/ext/FileCache/t/02maxopen.t +++ b/ext/FileCache/t/02maxopen.t @@ -2,7 +2,7 @@ use FileCache maxopen => 2; our @files; -BEGIN { @files = qw(foo bar baz quux) } +BEGIN { @files = map { "max_$_" } qw(foo bar baz quux) } END { 1 while unlink @files } use Test::More tests => 5; @@ -15,7 +15,7 @@ use Test::More tests => 5; my @cat; for my $path ( @files ){ - ok(fileno($path) || $path =~ /^(?:foo|bar)$/); + ok(fileno($path) || $path =~ /^max_(?:foo|bar)$/); next unless fileno($path); print $path "$path 2\n"; close($path); @@ -24,5 +24,5 @@ use Test::More tests => 5; push @cat, <$path>; close($path); } - ok( grep(/^(?:baz|quux) 2$/, @cat) == 2 ); + ok( grep(/^max_(?:baz|quux) 2$/, @cat) == 2 ); } diff --git a/ext/FileCache/t/03append.t b/ext/FileCache/t/03append.t index 3a82679..cf3e44f 100644 --- a/ext/FileCache/t/03append.t +++ b/ext/FileCache/t/03append.t @@ -2,7 +2,7 @@ use FileCache maxopen => 2; our @files; -BEGIN { @files = qw(foo bar baz quux Foo_Bar) } +BEGIN { @files = map { "append_$_" } qw(foo bar baz quux Foo_Bar) } END { 1 while unlink @files } use Test::More tests => 2; diff --git a/ext/FileCache/t/04twoarg.t b/ext/FileCache/t/04twoarg.t index 0189c46..da42f32 100644 --- a/ext/FileCache/t/04twoarg.t +++ b/ext/FileCache/t/04twoarg.t @@ -2,16 +2,16 @@ use FileCache; -END { unlink('foo') } +END { unlink('foo_2arg') } use Test::More tests => 1; {# Test 4: that 2 arg format works, and that we cycle on mode change - cacheout '>', "foo"; - print foo "foo 4\n"; - cacheout '+>', "foo"; - print foo "foo 44\n"; - seek(foo, 0, 0); - ok( eq "foo 44\n"); - close foo; + cacheout '>', "foo_2arg"; + print foo_2arg "foo 4\n"; + cacheout '+>', "foo_2arg"; + print foo_2arg "foo 44\n"; + seek(foo_2arg, 0, 0); + ok( eq "foo 44\n"); + close foo_2arg; } diff --git a/ext/FileCache/t/05override.t b/ext/FileCache/t/05override.t index 7edd5a3..0314ca3 100644 --- a/ext/FileCache/t/05override.t +++ b/ext/FileCache/t/05override.t @@ -2,12 +2,12 @@ use FileCache; -END { unlink("Foo_Bar") } +END { unlink("Foo_Bar_ov") } use Test::More tests => 1; {# Test 5: that close is overridden properly within the caller - cacheout local $_ = "Foo_Bar"; + cacheout local $_ = "Foo_Bar_ov"; print $_ "Hello World\n"; close($_); ok(!fileno($_)); diff --git a/ext/FileCache/t/07noimport.t b/ext/FileCache/t/07noimport.t index 0de92fe..8e1bbcf 100644 --- a/ext/FileCache/t/07noimport.t +++ b/ext/FileCache/t/07noimport.t @@ -8,7 +8,7 @@ use Test::More tests => 1; package Y; use FileCache (); - my $file = 'foo'; + my $file = 'foo_noimp'; END { unlink $file } FileCache::cacheout($file); print $file "bar"; -- 1.8.3.1