summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <rra@cpan.org>2022-01-19 20:25:06 -0800
committerRuss Allbery <rra@cpan.org>2022-01-19 20:25:06 -0800
commit4b4ffc9842c7f131d740e1e394d66c472072c78d (patch)
treefa6fb96b4df7c46caec49ee2038ce86fcdb8dfbb
parentbccbaa9e9fcd19606281c2494148f801cd803653 (diff)
Avoid using a recent Path::Tiny feature
The ability to generate a temporary file in a directory was added in Path::Tiny 0.120, which is very recent and more recent than our version pin. It was unnecessary and used only in the test suite, so just avoid using it.
-rwxr-xr-xt/cli/generate.t8
1 files changed, 3 insertions, 5 deletions
diff --git a/t/cli/generate.t b/t/cli/generate.t
index f3d37f3..7d4b766 100755
--- a/t/cli/generate.t
+++ b/t/cli/generate.t
@@ -29,15 +29,12 @@ BEGIN { use_ok('App::DocKnot::Command') }
my $docknot = App::DocKnot::Command->new();
isa_ok($docknot, 'App::DocKnot::Command');
-# Create a temporary directory for test output.
-my $tempdir = Path::Tiny->tempdir();
-
# Generate the package README file to a temporary file, read it into memory,
# and compare it to the actual README file. This duplicates part of the
# generate/self.t test, but via the command-line parser. Do this in a
# separate block so that $tempfile goes out of scope and will be cleaned up.
{
- my $tempfile = $tempdir->tempfile();
+ my $tempfile = Path::Tiny->tempfile();
$docknot->run('generate', 'readme', "$tempfile");
my $output = $tempfile->slurp_utf8();
is_file_contents($output, 'README', 'Generated README from argument list');
@@ -45,7 +42,7 @@ my $tempdir = Path::Tiny->tempdir();
# Do the same thing again, but using arguments from @ARGV.
{
- my $tempfile = $tempdir->tempfile();
+ my $tempfile = Path::Tiny->tempfile();
local @ARGV = ('generate', 'readme-md', "$tempfile");
$docknot->run();
my $output = $tempfile->slurp_utf8();
@@ -59,6 +56,7 @@ my $metadata_path = path('docs', 'docknot.yaml')->realpath();
# Generate all of the files using generate-all in a new temporary directory.
my $cwd = getcwd();
+my $tempdir = Path::Tiny->tempdir();
chdir($tempdir);
$docknot->run('generate-all', '-m', "$metadata_path");
my $output = path('README')->slurp_utf8();