diff options
author | Russ Allbery <rra@cpan.org> | 2021-12-24 19:37:05 -0800 |
---|---|---|
committer | Russ Allbery <rra@cpan.org> | 2021-12-24 19:37:05 -0800 |
commit | 9257e00ec67fb1c0ad07d8d91fb2bfbdd1c14949 (patch) | |
tree | 1698767fa096f6959d47c95859622d7cc9fe43cb /t | |
parent | 74c5d402923e0d4085200a38cfddeea8af16f341 (diff) |
Reformat code
Adopt the new -nvc option in Perl::Tidy 20211029 to disable the
intrusive vertical alignment formatting. Unfortunately, this
breaks all vertical alignment formatting, even when desired, so
work around that in a few places with special comments.
Diffstat (limited to 't')
-rwxr-xr-x | t/cli/generate.t | 8 | ||||
-rwxr-xr-x | t/cli/spin.t | 8 | ||||
-rwxr-xr-x | t/config/basic.t | 6 | ||||
-rwxr-xr-x | t/data/dist/package/Build.PL | 2 | ||||
-rw-r--r-- | t/data/perltidyrc | 4 | ||||
-rwxr-xr-x | t/data/regenerate-data | 8 | ||||
-rwxr-xr-x | t/dist/basic.t | 20 | ||||
-rwxr-xr-x | t/dist/commands.t | 2 | ||||
-rwxr-xr-x | t/docs/spdx-license.t | 32 | ||||
-rwxr-xr-x | t/generate/basic.t | 2 | ||||
-rwxr-xr-x | t/generate/output.t | 4 | ||||
-rw-r--r-- | t/lib/Test/RRA.pm | 10 | ||||
-rw-r--r-- | t/lib/Test/RRA/ModuleVersion.pm | 6 | ||||
-rwxr-xr-x | t/metadata/licenses.t | 6 | ||||
-rwxr-xr-x | t/spin/errors.t | 2 | ||||
-rwxr-xr-x | t/spin/file.t | 8 | ||||
-rwxr-xr-x | t/spin/markdown.t | 16 | ||||
-rwxr-xr-x | t/spin/sitemap.t | 8 | ||||
-rwxr-xr-x | t/spin/thread.t | 12 | ||||
-rwxr-xr-x | t/spin/tree.t | 22 | ||||
-rwxr-xr-x | t/spin/versions.t | 18 | ||||
-rwxr-xr-x | t/style/coverage.t | 4 | ||||
-rwxr-xr-x | t/style/module-version.t | 4 | ||||
-rwxr-xr-x | t/style/strict.t | 2 | ||||
-rwxr-xr-x | t/update/basic.t | 6 |
25 files changed, 113 insertions, 107 deletions
diff --git a/t/cli/generate.t b/t/cli/generate.t index 38c8b2e..87c8f68 100755 --- a/t/cli/generate.t +++ b/t/cli/generate.t @@ -39,7 +39,7 @@ my $tempdir = File::Temp->newdir(); # 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 = File::Temp->new(DIR => $tempdir); + my $tempfile = File::Temp->new(DIR => $tempdir); my $output_path = $tempfile->filename; $docknot->run('generate', 'readme', $output_path); my $output = slurp($output_path); @@ -48,7 +48,7 @@ my $tempdir = File::Temp->newdir(); # Do the same thing again, but using arguments from @ARGV. { - my $tempfile = File::Temp->new(DIR => $tempdir); + my $tempfile = File::Temp->new(DIR => $tempdir); my $output_path = $tempfile->filename; local @ARGV = ('generate', 'readme-md', "$output_path"); $docknot->run(); @@ -57,9 +57,9 @@ my $tempdir = File::Temp->newdir(); } # Save the paths to various files in the source directory. -my $readme_path = File::Spec->catfile(getcwd(), 'README'); +my $readme_path = File::Spec->catfile(getcwd(), 'README'); my $readme_md_path = File::Spec->catfile(getcwd(), 'README.md'); -my $metadata_path = File::Spec->catfile(getcwd(), 'docs', 'docknot.yaml'); +my $metadata_path = File::Spec->catfile(getcwd(), 'docs', 'docknot.yaml'); # Generate all of the files using generate-all in a new temporary directory. my $tmpdir = File::Temp->newdir(); diff --git a/t/cli/spin.t b/t/cli/spin.t index 674047f..58bf2f7 100755 --- a/t/cli/spin.t +++ b/t/cli/spin.t @@ -39,10 +39,10 @@ isa_ok($docknot, 'App::DocKnot::Command'); my $tempdir = File::Temp->newdir(); # Spin a single file. -my $datadir = File::Spec->catfile('t', 'data', 'spin'); -my $input = File::Spec->catfile($datadir, 'input', 'index.th'); +my $datadir = File::Spec->catfile('t', 'data', 'spin'); +my $input = File::Spec->catfile($datadir, 'input', 'index.th'); my $expected = File::Spec->catfile($datadir, 'output', 'index.html'); -my $output = File::Spec->catfile($tempdir->dirname, 'index.html'); +my $output = File::Spec->catfile($tempdir->dirname, 'index.html'); $docknot->run('spin-thread', '-s', '/~eagle/styles', $input, $output); is_spin_output($output, $expected, 'spin-thread (output specified)'); @@ -63,7 +63,7 @@ $input = File::Spec->catfile($datadir, 'input'); dircopy($input, $indir->dirname) or die "Cannot copy $input to $indir: $!\n"; my $rpod_source = File::Spec->catfile(getcwd(), 'lib', 'App', 'DocKnot.pm'); -my $rpod_path = File::Spec->catfile( +my $rpod_path = File::Spec->catfile( $indir->dirname, 'software', 'docknot', 'api', 'app-docknot.rpod', ); diff --git a/t/config/basic.t b/t/config/basic.t index 018ece6..87cd0c5 100755 --- a/t/config/basic.t +++ b/t/config/basic.t @@ -35,8 +35,8 @@ my $data_ref = $config->config(); ok($data_ref->{build}{install}, 'build/install defaults to true'); # Check that the license data is expanded correctly. -my $licenses_path = module_file('App::DocKnot', 'licenses.yaml'); -my $licenses_ref = YAML::XS::LoadFile($licenses_path); +my $licenses_path = module_file('App::DocKnot', 'licenses.yaml'); +my $licenses_ref = YAML::XS::LoadFile($licenses_path); my $perl_license_ref = $licenses_ref->{Perl}; is($data_ref->{license}{summary}, $perl_license_ref->{summary}, 'summary'); -is($data_ref->{license}{text}, $perl_license_ref->{text}, 'text'); +is($data_ref->{license}{text}, $perl_license_ref->{text}, 'text'); diff --git a/t/data/dist/package/Build.PL b/t/data/dist/package/Build.PL index b50f458..84edf47 100755 --- a/t/data/dist/package/Build.PL +++ b/t/data/dist/package/Build.PL @@ -14,6 +14,7 @@ use warnings; use Module::Build; +#<<< my $build = Module::Build->new( dist_abstract => 'Empty test module', dist_author => 'Russ Allbery <rra@cpan.org>', @@ -23,4 +24,5 @@ my $build = Module::Build->new( add_to_cleanup => [qw(MANIFEST.bak MYMETA.json.lock cover_db)], configure_requires => { 'Module::Build' => 0.36 }, ); +#>>> $build->create_build_script; diff --git a/t/data/perltidyrc b/t/data/perltidyrc index f5a08b5..62623c9 100644 --- a/t/data/perltidyrc +++ b/t/data/perltidyrc @@ -18,11 +18,13 @@ # SPDX-License-Identifier: FSFAP -bbao # put line breaks before any operator --boc # do not re-break lists, since perltidy is awful at this -nbbc # don't force blank lines before comments (bad for else blocks) +-nbl # keep opening braces on the same line +-boc # do not re-break lists, since perltidy is awful at this -ce # cuddle braces around else -l=79 # usually use 78, but don't want 79-long lines reformatted -pt=2 # don't add extra whitespace around parentheses -sbt=2 # ...or square brackets -sfs # no space before semicolon in for (not that I use this form) +-nvc # disable vertical alignment of = and similar symbols -xci # improve indentation of nested structures diff --git a/t/data/regenerate-data b/t/data/regenerate-data index 9037170..b95b87f 100755 --- a/t/data/regenerate-data +++ b/t/data/regenerate-data @@ -51,9 +51,9 @@ for my $package (@packages) { # The test of spinning a tree of files uses a reference to App::DocKnot's own # POD documentation. Regenerate the expected output in case the POD has # changed. -my $source = File::Spec->catdir('lib', 'App', 'DocKnot.pm'); +my $source = File::Spec->catdir('lib', 'App', 'DocKnot.pm'); my $podthread = Pod::Thread->new(navbar => 1); -my $spin = App::DocKnot::Spin::Thread->new(); +my $spin = App::DocKnot::Spin::Thread->new(); my $thread; $podthread->output_string(\$thread); $podthread->parse_file($source); @@ -68,7 +68,7 @@ my $links = <<'EOD'; <link rel="top" href="../../../" /> EOD my $comment = '<!-- Spun by DocKnot %VERSION% on %DATE% -->'; -my $navbar = <<'EOD'; +my $navbar = <<'EOD'; <table class="navbar"><tr> <td class="navleft"></td> <td> @@ -93,7 +93,7 @@ $html =~ s{ (</body>) }{$navbar$address$1}xms; # Replace the expected data file. my $output = File::Spec->catdir( - 't', 'data', 'spin', 'output', 'software', 'docknot', + 't', 'data', 'spin', 'output', 'software', 'docknot', 'api', 'app-docknot.html', ); open(my $fh, '>', $output); diff --git a/t/dist/basic.t b/t/dist/basic.t index 319b5cb..6fcf2bc 100755 --- a/t/dist/basic.t +++ b/t/dist/basic.t @@ -28,14 +28,14 @@ local $ENV{XDG_CONFIG_HOME} = '/nonexistent'; local $ENV{XDG_CONFIG_DIRS} = '/nonexistent'; # Find the full path to the test data. -my $cwd = getcwd() or die "$0: cannot get working directory: $!\n"; +my $cwd = getcwd() or die "$0: cannot get working directory: $!\n"; my $dataroot = File::Spec->catfile($cwd, 't', 'data', 'dist', 'package'); my $gpg_path = File::Spec->catfile($cwd, 't', 'data', 'dist', 'fake-gpg'); # Set up a temporary directory. -my $dir = File::Temp->newdir(); +my $dir = File::Temp->newdir(); my $sourcedir = File::Spec->catfile($dir, 'source'); -my $distdir = File::Spec->catfile($dir, 'dist'); +my $distdir = File::Spec->catfile($dir, 'dist'); # Create a new repository, copy all files from the data directory, and commit # them. We have to rename the test while we copy it to avoid having it picked @@ -46,10 +46,10 @@ my $testpath = File::Spec->catfile($sourcedir, 't', 'api', 'empty.t'); rename($testpath . '.in', $testpath); Git::Repository->run('init', { cwd => $sourcedir, quiet => 1 }); my $repo = Git::Repository->new(work_tree => $sourcedir); -$repo->run(config => '--add', 'user.name', 'Test'); +$repo->run(config => '--add', 'user.name', 'Test'); $repo->run(config => '--add', 'user.email', 'test@example.com'); -$repo->run(add => '-A', q{.}); -$repo->run(commit => '-q', '-m', 'Initial commit'); +$repo->run(add => '-A', q{.}); +$repo->run(commit => '-q', '-m', 'Initial commit'); # Check whether we have all the necessary tools to run the test. my $result; @@ -83,9 +83,9 @@ my $dist = App::DocKnot::Dist->new({ distdir => $distdir, perl => $^X }); capture_stdout { eval { $dist->make_distribution() }; }; -ok(-e File::Spec->catfile($distdir, 'Empty-1.00.tar.gz'), 'dist exists'); -ok(-e File::Spec->catfile($distdir, 'Empty-1.00.tar.xz'), 'xz dist exists'); -ok(!-e File::Spec->catfile($distdir, 'Empty-1.00.tar'), 'tarball missing'); +ok(-e File::Spec->catfile($distdir, 'Empty-1.00.tar.gz'), 'dist exists'); +ok(-e File::Spec->catfile($distdir, 'Empty-1.00.tar.xz'), 'xz dist exists'); +ok(!-e File::Spec->catfile($distdir, 'Empty-1.00.tar'), 'tarball missing'); ok(!-e File::Spec->catfile($distdir, 'Empty-1.00.tar.gz.asc'), 'no signature'); ok(!-e File::Spec->catfile($distdir, 'Empty-1.00.tar.xz.asc'), 'no signature'); is($@, q{}, 'no errors'); @@ -145,7 +145,7 @@ $stdout = capture_stdout { eval { $dist->make_distribution() }; }; is($@, "2 files missing from distribution\n", 'correct error for two files'); -like($stdout, qr{ some-file }xms, 'output mentions the first file'); +like($stdout, qr{ some-file }xms, 'output mentions the first file'); like($stdout, qr{ another-file }xms, 'output mentions the other file'); @missing = $dist->check_dist($sourcedir, $tarball); is_deeply(['another-file', 'some-file'], \@missing, 'check_dist matches'); diff --git a/t/dist/commands.t b/t/dist/commands.t index cbd29c3..9ca697c 100755 --- a/t/dist/commands.t +++ b/t/dist/commands.t @@ -119,5 +119,5 @@ $metadata_path $docknot = App::DocKnot::Dist->new({ distdir => q{.}, metadata => $metadata_path }); @expected = (['make', 'dist']); -@seen = $docknot->commands(); +@seen = $docknot->commands(); is_deeply(\@seen, \@expected, 'make'); diff --git a/t/docs/spdx-license.t b/t/docs/spdx-license.t index 4e5b7f9..15ee7e0 100755 --- a/t/docs/spdx-license.t +++ b/t/docs/spdx-license.t @@ -45,8 +45,9 @@ use Test::More; # File name (the file without any directory component) and path patterns to # skip for this check. ## no critic (RegularExpressions::ProhibitFixedStringMatches) +#<<< my @IGNORE = ( - qr{ \A Build ( [.] (?!PL) .* )? \z }ixms, # Generated file from Build.PL + qr{ \A Build ( [.] (?!PL) .* )? \z }ixms, # Generated file from Build.PL qr{ \A LICENSE \z }xms, # Generated file, no license itself qr{ \A (Changes|NEWS|THANKS) \z }xms, # Package license should be fine qr{ \A TODO \z }xms, # Package license should be fine @@ -58,20 +59,21 @@ my @IGNORE = ( qr{ ~ \z }xms, # Backup files ); my @IGNORE_PATHS = ( - qr{ \A [.] / [.] git/ }xms, # Version control files - qr{ \A [.] / [.] pc/ }xms, # quilt metadata files - qr{ \A [.] /_build/ }xms, # Module::Build metadata - qr{ \A [.] /blib/ }xms, # Perl build system artifacts - qr{ \A [.] /cover_db/ }xms, # Artifacts from coverage testing - qr{ \A [.] /debian/ }xms, # Found in debian/* branches - qr{ \A [.] /docs/metadata/ }xms, # Package license should be fine - qr{ \A [.] /README ( [.] .* )? \z }xms, # Package license should be fine - qr{ \A [.] /share/ }xms, # Package license should be fine - qr{ \A [.] /t/data/generate/ }xms, # Test metadata - qr{ \A [.] /t/data/spin/ }xms, # Test metadata - qr{ \A [.] /t/data/update/ }xms, # Test output - qr{ \A [.] /t/data .* [.] json \z }xms, # Test metadata + qr{ \A [.] / [.] git/ }xms, # Version control files + qr{ \A [.] / [.] pc/ }xms, # quilt metadata files + qr{ \A [.] /_build/ }xms, # Module::Build metadata + qr{ \A [.] /blib/ }xms, # Perl build system artifacts + qr{ \A [.] /cover_db/ }xms, # Artifacts from coverage testing + qr{ \A [.] /debian/ }xms, # Found in debian/* branches + qr{ \A [.] /docs/metadata/ }xms, # Package license should be fine + qr{ \A [.] /README ( [.] .* )? \z }xms, # Package license should be fine + qr{ \A [.] /share/ }xms, # Package license should be fine + qr{ \A [.] /t/data/generate/ }xms, # Test metadata + qr{ \A [.] /t/data/spin/ }xms, # Test metadata + qr{ \A [.] /t/data/update/ }xms, # Test output + qr{ \A [.] /t/data .* [.] json \z }xms, # Test metadata ); +#>>> ## use critic # Only run this test during automated testing, since failure doesn't indicate @@ -85,7 +87,7 @@ skip_unless_automated('SPDX identifier tests'); # Returns: undef sub check_file { my $filename = $_; - my $path = $File::Find::name; + my $path = $File::Find::name; # Ignore files in the whitelist and binary files. for my $pattern (@IGNORE) { diff --git a/t/generate/basic.t b/t/generate/basic.t index f553e20..20af8b0 100755 --- a/t/generate/basic.t +++ b/t/generate/basic.t @@ -43,7 +43,7 @@ for my $test (@tests) { # Loop through the possible templates. for my $template (qw(readme readme-md thread)) { - my $got = encode('utf-8', $docknot->generate($template)); + my $got = encode('utf-8', $docknot->generate($template)); my $path = File::Spec->catfile($dataroot, $test, 'output', $template); is_file_contents($got, $path, "$template for $test"); } diff --git a/t/generate/output.t b/t/generate/output.t index c23538e..2a66451 100755 --- a/t/generate/output.t +++ b/t/generate/output.t @@ -34,11 +34,11 @@ my $docknot = App::DocKnot::Generate->new({ metadata => $metadata_path }); isa_ok($docknot, 'App::DocKnot::Generate'); # Save the paths to the real README and README.md files. -my $readme_path = File::Spec->catfile(getcwd(), 'README'); +my $readme_path = File::Spec->catfile(getcwd(), 'README'); my $readme_md_path = File::Spec->catfile(getcwd(), 'README.md'); # Write the README output for the DocKnot package to a temporary file. -my $tmp = File::Temp->new(); +my $tmp = File::Temp->new(); my $tmpname = $tmp->filename; $docknot->generate_output('readme', $tmpname); my $output = slurp($tmpname); diff --git a/t/lib/Test/RRA.pm b/t/lib/Test/RRA.pm index 1a3ceab..56417c4 100644 --- a/t/lib/Test/RRA.pm +++ b/t/lib/Test/RRA.pm @@ -83,11 +83,11 @@ sub is_file_contents { eval { require IPC::System::Simple; - my $tmp = File::Temp->new(); + my $tmp = File::Temp->new(); my $tmpname = $tmp->filename; print {$tmp} $got or BAIL_OUT("Cannot write to $tmpname: $!\n"); my @command = ('diff', '-u', $expected, $tmpname); - my $diff = IPC::System::Simple::capturex([0 .. 1], @command); + my $diff = IPC::System::Simple::capturex([0 .. 1], @command); diag($diff); }; if ($@) { @@ -165,15 +165,15 @@ sub use_prereq { ## no critic (ValuesAndExpressions::ProhibitImplicitNewlines) my ($result, $error, $sigdie); { - local $@ = undef; - local $! = undef; + local $@ = undef; + local $! = undef; local $SIG{__DIE__} = undef; $result = eval qq{ package $package; use $module $version \@imports; 1; }; - $error = $@; + $error = $@; $sigdie = $SIG{__DIE__} || undef; } diff --git a/t/lib/Test/RRA/ModuleVersion.pm b/t/lib/Test/RRA/ModuleVersion.pm index 86bd9f1..18f3ae1 100644 --- a/t/lib/Test/RRA/ModuleVersion.pm +++ b/t/lib/Test/RRA/ModuleVersion.pm @@ -135,7 +135,7 @@ sub _update_module_version { } # Scan for the version and replace it. - open(my $in, q{<}, $file) or die "$0: cannot open $file: $!\n"; + open(my $in, q{<}, $file) or die "$0: cannot open $file: $!\n"; open(my $out, q{>}, "$file.new") or die "$0: cannot create $file.new: $!\n"; SCAN: @@ -151,8 +151,8 @@ sub _update_module_version { # Copy the rest of the input file to the output file. print {$out} <$in> or die "$0: cannot write to $file.new: $!\n"; - close($out) or die "$0: cannot flush $file.new: $!\n"; - close($in) or die "$0: error reading from $file: $!\n"; + close($out) or die "$0: cannot flush $file.new: $!\n"; + close($in) or die "$0: error reading from $file: $!\n"; # All done. Rename the new file over top of the old file. rename("$file.new", $file) diff --git a/t/metadata/licenses.t b/t/metadata/licenses.t index 422dbd3..94e6c50 100755 --- a/t/metadata/licenses.t +++ b/t/metadata/licenses.t @@ -24,8 +24,8 @@ BEGIN { use_ok('App::DocKnot') } # Check the schema of the licenses.yaml file. my $licenses_path = module_file('App::DocKnot', 'licenses.yaml'); -my $licenses_ref = YAML::XS::LoadFile($licenses_path); -my $schema_path = module_file('App::DocKnot', 'schema/licenses.yaml'); -my $schema_ref = YAML::XS::LoadFile($schema_path); +my $licenses_ref = YAML::XS::LoadFile($licenses_path); +my $schema_path = module_file('App::DocKnot', 'schema/licenses.yaml'); +my $schema_ref = YAML::XS::LoadFile($schema_path); eval { validate($schema_ref, $licenses_ref) }; is($@, q{}, 'licenses.yaml fails schema validation'); diff --git a/t/spin/errors.t b/t/spin/errors.t index ae1c308..d4cc565 100755 --- a/t/spin/errors.t +++ b/t/spin/errors.t @@ -36,7 +36,7 @@ require_ok('App::DocKnot::Spin::Thread'); # Spin the errors file with output captured. my $input = File::Spec->catfile('t', 'data', 'spin', 'errors', 'errors.th'); -my $spin = App::DocKnot::Spin::Thread->new(); +my $spin = App::DocKnot::Spin::Thread->new(); my ($stdout, $stderr) = capture { $spin->spin_thread_file($input); }; diff --git a/t/spin/file.t b/t/spin/file.t index 354ec77..2f645e5 100755 --- a/t/spin/file.t +++ b/t/spin/file.t @@ -26,10 +26,10 @@ require_ok('App::DocKnot::Spin::Thread'); # Spin a single file. my $tempfile = File::Temp->new(); -my $datadir = File::Spec->catfile('t', 'data', 'spin'); -my $inputdir = File::Spec->catfile($datadir, 'input'); -my $input = File::Spec->catfile($inputdir, 'index.th'); -my $expected = File::Spec->catfile($datadir, 'output', 'index.html'); +my $datadir = File::Spec->catfile('t', 'data', 'spin'); +my $inputdir = File::Spec->catfile($datadir, 'input'); +my $input = File::Spec->catfile($inputdir, 'index.th'); +my $expected = File::Spec->catfile($datadir, 'output', 'index.html'); my $spin = App::DocKnot::Spin::Thread->new({ 'style-url' => '/~eagle/styles/' }); $spin->spin_thread_file($input, $tempfile->filename); diff --git a/t/spin/markdown.t b/t/spin/markdown.t index 7b098bb..bf8de61 100755 --- a/t/spin/markdown.t +++ b/t/spin/markdown.t @@ -38,19 +38,19 @@ require_ok('App::DocKnot::Spin::Pointer'); # Ensure Devel::Cover has loaded the HTML template before we start changing # the working directory with File::Find. (This is a dumb workaround, but I # can't find a better one; +ignore doesn't work.) -my $pointer = App::DocKnot::Spin::Pointer->new(); +my $pointer = App::DocKnot::Spin::Pointer->new(); my $template = $pointer->appdata_path('templates', 'html.tmpl'); -my $tt = Template->new({ ABSOLUTE => 1 }) or croak(Template->error()); +my $tt = Template->new({ ABSOLUTE => 1 }) or croak(Template->error()); $tt->process($template, {}, \my $result); # Spin the tree of files and check the result. -my $datadir = File::Spec->catfile('t', 'data', 'spin', 'markdown'); -my $input = File::Spec->catfile($datadir, 'input'); -my $output = File::Temp->newdir(); +my $datadir = File::Spec->catfile('t', 'data', 'spin', 'markdown'); +my $input = File::Spec->catfile($datadir, 'input'); +my $output = File::Temp->newdir(); my $expected = File::Spec->catfile($datadir, 'output'); -my $spin = App::DocKnot::Spin->new({ 'style-url' => '/~eagle/styles/' }); -my $stdout = capture_stdout { $spin->spin($input, $output->dirname) }; -my $count = is_spin_output_tree($output, $expected, 'spin'); +my $spin = App::DocKnot::Spin->new({ 'style-url' => '/~eagle/styles/' }); +my $stdout = capture_stdout { $spin->spin($input, $output->dirname) }; +my $count = is_spin_output_tree($output, $expected, 'spin'); # Report the end of testing. done_testing($count + 2); diff --git a/t/spin/sitemap.t b/t/spin/sitemap.t index 0ae949c..59f8fe3 100755 --- a/t/spin/sitemap.t +++ b/t/spin/sitemap.t @@ -21,12 +21,12 @@ require_ok('App::DocKnot::Spin::Sitemap'); # Parse a complex .sitemap file. my $datadir = File::Spec->catfile('t', 'data', 'spin', 'sitemap'); -my $path = File::Spec->catfile($datadir, 'complex'); +my $path = File::Spec->catfile($datadir, 'complex'); my $sitemap = App::DocKnot::Spin::Sitemap->new($path); isa_ok($sitemap, 'App::DocKnot::Spin::Sitemap'); # Check the generated sitemap. -my $output = join(q{}, $sitemap->sitemap()); +my $output = join(q{}, $sitemap->sitemap()); my $expected = File::Spec->catfile($datadir, 'complex.html'); is_file_contents($output, $expected, 'sitemap output'); @@ -46,7 +46,7 @@ my @expected = ( qq{ <link rel="top" href="../" />\n}, ); is_deeply(\@links, \@expected, 'links output'); -@navbar = $sitemap->navbar('/faqs/soundness-inn.html'); +@navbar = $sitemap->navbar('/faqs/soundness-inn.html'); @expected = ( qq{<table class="navbar"><tr>\n}, qq{ <td class="navleft"></td>\n}, @@ -61,7 +61,7 @@ is_deeply(\@links, \@expected, 'links output'); is_deeply(\@navbar, \@expected, 'navbar output'); # Check links for a page with long adjacent titles to test the wrapping. -@links = $sitemap->links('/notes/cvs/basic-usage.html'); +@links = $sitemap->links('/notes/cvs/basic-usage.html'); @expected = ( qq{ <link rel="previous" href="why.html"\n}, qq{ title="Why put a set of files into CVS?" />\n}, diff --git a/t/spin/thread.t b/t/spin/thread.t index 8373eba..c18a743 100755 --- a/t/spin/thread.t +++ b/t/spin/thread.t @@ -23,16 +23,16 @@ use Test::More tests => 2; require_ok('App::DocKnot::Spin::Thread'); # Test data file paths. -my $datadir = File::Spec->catfile('t', 'data', 'spin'); -my $inputdir = File::Spec->catfile($datadir, 'input'); -my $input = File::Spec->catfile($inputdir, 'index.th'); -my $expected = File::Spec->catfile($datadir, 'output', 'index.html'); +my $datadir = File::Spec->catfile('t', 'data', 'spin'); +my $inputdir = File::Spec->catfile($datadir, 'input'); +my $input = File::Spec->catfile($inputdir, 'index.th'); +my $expected = File::Spec->catfile($datadir, 'output', 'index.html'); # The expected output is a bit different since we won't add timestamp # information or the filename to the comment, so we have to generate our # expected output file. my $tempfile = File::Temp->new(); -my $output = slurp($expected); +my $output = slurp($expected); $output =~ s{ from [ ] index[.]th [ ] }{}xms; $output =~ s{ <address> .* </address> \n }{}xms; print {$tempfile} $output or die "Cannot write to $tempfile: $!\n"; @@ -43,7 +43,7 @@ $tempfile->flush(); my $spin = App::DocKnot::Spin::Thread->new({ 'style-url' => '/~eagle/styles/' }); my $thread = slurp($input); -my $cwd = getcwd(); +my $cwd = getcwd(); chdir($inputdir); my $html = $spin->spin_thread($thread); chdir($cwd); diff --git a/t/spin/tree.t b/t/spin/tree.t index b3bf302..2a173a7 100755 --- a/t/spin/tree.t +++ b/t/spin/tree.t @@ -72,13 +72,13 @@ require_ok('App::DocKnot::Spin'); # additional thread files. Replace the rpod pointer since it points to a # relative path in the source tree, but change its modification timestamp to # something in the past. -my $tmpdir = File::Temp->newdir(); +my $tmpdir = File::Temp->newdir(); my $datadir = File::Spec->catfile('t', 'data', 'spin'); -my $input = File::Spec->catfile($datadir, 'input'); +my $input = File::Spec->catfile($datadir, 'input'); dircopy($input, $tmpdir->dirname) or die "Cannot copy $input to $tmpdir: $!\n"; my $rpod_source = File::Spec->catfile(getcwd(), 'lib', 'App', 'DocKnot.pm'); -my $rpod_path = File::Spec->catfile( +my $rpod_path = File::Spec->catfile( $tmpdir->dirname, 'software', 'docknot', 'api', 'app-docknot.rpod', ); @@ -89,18 +89,18 @@ close($fh); my $old_timestamp = time() - 10; # Spin a tree of files. -my $output = File::Temp->newdir(); +my $output = File::Temp->newdir(); my $expected = File::Spec->catfile($datadir, 'output'); -my $spin = App::DocKnot::Spin->new({ 'style-url' => '/~eagle/styles/' }); -my $stdout = capture_stdout { +my $spin = App::DocKnot::Spin->new({ 'style-url' => '/~eagle/styles/' }); +my $stdout = capture_stdout { $spin->spin($tmpdir->dirname, $output->dirname); }; my $count = is_spin_output_tree($output, $expected, 'spin'); is($stdout, $EXPECTED_OUTPUT, 'Expected spin output'); # Create a bogus file in the output tree. -my $bogus = File::Spec->catfile($output->dirname, 'bogus'); -my $bogus_file = File::Spec->catfile($bogus, 'some-file'); +my $bogus = File::Spec->catfile($output->dirname, 'bogus'); +my $bogus_file = File::Spec->catfile($bogus, 'some-file'); mkdir($bogus); open($fh, '>', $bogus_file); print {$fh} "Some stuff\n" or die "Cannot write to $bogus_file: $!\n"; @@ -154,7 +154,7 @@ like( qr{ <title> New [ ] Title </title> }xms, 'POD title override worked', ); -like($page, qr{ <h1> New [ ] Title </h1> }xms, 'POD h1 override worked'); +like($page, qr{ <h1> New [ ] Title </h1> }xms, 'POD h1 override worked'); like($page, qr{ Table [ ] of [ ] Contents }xms, 'POD table of contents'); # Set the time back so that it won't be generated again. @@ -165,8 +165,8 @@ utime(time() - 5, time() - 5, $rpod_path) # timestamp to ten seconds into the future. This should force regeneration of # only the software/docknot/index.html file. my $versions_path = File::Spec->catfile($tmpdir->dirname, '.versions'); -my $versions = slurp($versions_path); -my $new_date = strftime('%Y-%m-%d %T', localtime(time() + 10)); +my $versions = slurp($versions_path); +my $new_date = strftime('%Y-%m-%d %T', localtime(time() + 10)); $versions =~ s{ \d{4}-\d\d-\d\d [ ] [\d:]+ }{$new_date}xms; chmod(0644, $versions_path); open(my $versions_fh, '>', $versions_path); diff --git a/t/spin/versions.t b/t/spin/versions.t index 03230c8..640e143 100755 --- a/t/spin/versions.t +++ b/t/spin/versions.t @@ -24,12 +24,12 @@ local $ENV{TZ} = 'America/Los_Angeles'; tzset(); # Parse the file. -my $path = File::Spec->catfile('t', 'data', 'spin', 'input', '.versions'); +my $path = File::Spec->catfile('t', 'data', 'spin', 'input', '.versions'); my $versions = App::DocKnot::Spin::Versions->new($path); isa_ok($versions, 'App::DocKnot::Spin::Versions'); # Check the resulting information. -is($versions->version('docknot'), '4.01', 'docknot version'); +is($versions->version('docknot'), '4.01', 'docknot version'); is($versions->release_date('docknot'), '2021-02-27', 'docknot release date'); is( $versions->latest_release('software/docknot/index.th'), 1614460092, @@ -37,17 +37,17 @@ is( ); # Unknown products or files. -is($versions->version('unknown'), undef, 'unknown version'); -is($versions->release_date('unknown'), undef, 'unknown release date'); -is($versions->latest_release('index.th'), 0, 'unknown file index.th'); +is($versions->version('unknown'), undef, 'unknown version'); +is($versions->release_date('unknown'), undef, 'unknown release date'); +is($versions->latest_release('index.th'), 0, 'unknown file index.th'); # Check continuation handling and a line without dependencies. my $inputdir = File::Spec->catfile('t', 'data', 'spin', 'versions'); -$path = File::Spec->catfile($inputdir, 'continuation'); +$path = File::Spec->catfile($inputdir, 'continuation'); $versions = App::DocKnot::Spin::Versions->new($path); -is($versions->version('docknot'), '4.01', 'docknot version'); -is($versions->release_date('docknot'), '2021-02-27', 'docknot release date'); -is($versions->version('other-package'), '1.00', 'other-package version'); +is($versions->version('docknot'), '4.01', 'docknot version'); +is($versions->release_date('docknot'), '2021-02-27', 'docknot release date'); +is($versions->version('other-package'), '1.00', 'other-package version'); is( $versions->release_date('other-package'), '2021-09-07', 'other-package release date', diff --git a/t/style/coverage.t b/t/style/coverage.t index 6cb4c22..ae709fb 100755 --- a/t/style/coverage.t +++ b/t/style/coverage.t @@ -54,9 +54,9 @@ use_prereq('Test::Strict'); # Build a list of test directories to use for coverage. my %ignore = map { $_ => 1 } qw(config data docs lib style), @COVERAGE_SKIP_TESTS; -opendir(my $testdir, 't') or BAIL_OUT("cannot open t: $!"); +opendir(my $testdir, 't') or BAIL_OUT("cannot open t: $!"); my @t_dirs = readdir($testdir) or BAIL_OUT("cannot read t: $!"); -closedir($testdir) or BAIL_OUT("cannot close t: $!"); +closedir($testdir) or BAIL_OUT("cannot close t: $!"); # Filter out ignored and system directories. @t_dirs = grep { !$ignore{$_} } File::Spec->no_upwards(@t_dirs); diff --git a/t/style/module-version.t b/t/style/module-version.t index 0d78c3d..8339da5 100755 --- a/t/style/module-version.t +++ b/t/style/module-version.t @@ -42,9 +42,9 @@ if (@ARGV) { # Throws: Text exception if MYMETA.json is not found or doesn't contain a # version sub dist_version { - my $json = JSON::PP->new->utf8(1); + my $json = JSON::PP->new->utf8(1); my $metadata = $json->decode(scalar(slurp('MYMETA.json'))); - my $version = $metadata->{version}; + my $version = $metadata->{version}; if (!defined($version)) { die "$0: cannot find version number in MYMETA.json\n"; } diff --git a/t/style/strict.t b/t/style/strict.t index b83d348..8b92fb5 100755 --- a/t/style/strict.t +++ b/t/style/strict.t @@ -59,7 +59,7 @@ my %EXCLUDE = map { $_ => 1 } qw(.git blib); # Returns: 1 if it should be checked, undef otherwise. sub should_check { my ($file) = @_; - return if $EXCLUDE{$file}; + return if $EXCLUDE{$file}; return 1 if -d $file; return 1 if $file =~ m{ [.] PL \z }xms; return; diff --git a/t/update/basic.t b/t/update/basic.t index a21343f..5dc2be1 100755 --- a/t/update/basic.t +++ b/t/update/basic.t @@ -39,11 +39,11 @@ my $tempdir = File::Temp->newdir(); for my $test (@tests) { my $metadata_path = File::Spec->catfile($dataroot, $test, 'old'); my $expected_path = File::Spec->catfile($dataroot, $test, 'docknot.yaml'); - my $output_path = File::Spec->catfile($tempdir, "$test.yaml"); - my $docknot = App::DocKnot::Update->new( + my $output_path = File::Spec->catfile($tempdir, "$test.yaml"); + my $docknot = App::DocKnot::Update->new( { metadata => $metadata_path, - output => $output_path, + output => $output_path, }, ); isa_ok($docknot, 'App::DocKnot::Update', "for $test"); |