summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRuss Allbery <rra@cpan.org>2021-09-06 23:40:41 -0700
committerRuss Allbery <rra@cpan.org>2021-09-06 23:44:16 -0700
commit86ce267739086ca64eacc3a86a50d75d061502e7 (patch)
tree7e75364c4993b86963fc3b83f2d13964d6ffc23b /t
parentf5975f7cf8901664b2feaf5d347f0e9c70d22226 (diff)
Fix spin with external converters
The refactorings broke external converters. Fix that, hopefully, and add a test for pod2html. Refactor the division of labor between the conversion methods and the common method so that it works without reinvoking spin via $FULLPATH. Drop the $FULLPATH global variable. Update perltidy configuration and apply the reformattings to avoid some really horrible formatting decisions in some of the new test code. Add a dependency on Pod::Thread, which is currently only used for the external script but will eventually be used for its API.
Diffstat (limited to 't')
-rw-r--r--t/data/perltidyrc3
-rw-r--r--t/data/spin/input/.sitemap2
-rw-r--r--t/data/spin/input/software/docknot/api/app-docknot.rpod1
-rw-r--r--t/data/spin/output/software/docknot/api/app-docknot.html147
-rwxr-xr-xt/dist/basic.t6
-rw-r--r--t/lib/Test/RRA.pm2
-rw-r--r--t/lib/Test/RRA/Config.pm6
-rwxr-xr-xt/spin/tree.t15
-rwxr-xr-xt/style/obsolete-strings.t4
9 files changed, 176 insertions, 10 deletions
diff --git a/t/data/perltidyrc b/t/data/perltidyrc
index c2d0e40..f5a08b5 100644
--- a/t/data/perltidyrc
+++ b/t/data/perltidyrc
@@ -6,6 +6,7 @@
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
# Written by Russ Allbery <eagle@eyrie.org>
+# Copyright 2021 Russ Allbery <eagle@eyrie.org>
# Copyright 2012-2013
# The Board of Trustees of the Leland Stanford Junior University
#
@@ -17,9 +18,11 @@
# 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)
-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)
+-xci # improve indentation of nested structures
diff --git a/t/data/spin/input/.sitemap b/t/data/spin/input/.sitemap
index 881fc18..595191a 100644
--- a/t/data/spin/input/.sitemap
+++ b/t/data/spin/input/.sitemap
@@ -2,6 +2,8 @@
/software/: Software
/software/cvslog/: cvslog
/software/docknot/: DocKnot
+ /software/docknot/api/app-docknot.html: App::DocKnot
+ /software/docknot/api/app-docknot-command.html: App::DocKnot::Command
/software/rra-c-util/: rra-c-util
/faqs/: FAQs and Documentation
/photos/: Photos
diff --git a/t/data/spin/input/software/docknot/api/app-docknot.rpod b/t/data/spin/input/software/docknot/api/app-docknot.rpod
new file mode 100644
index 0000000..5075ec0
--- /dev/null
+++ b/t/data/spin/input/software/docknot/api/app-docknot.rpod
@@ -0,0 +1 @@
+../../../../../../../lib/App/DocKnot.pm
diff --git a/t/data/spin/output/software/docknot/api/app-docknot.html b/t/data/spin/output/software/docknot/api/app-docknot.html
new file mode 100644
index 0000000..b3d5244
--- /dev/null
+++ b/t/data/spin/output/software/docknot/api/app-docknot.html
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>App::DocKnot</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="stylesheet" href="/~eagle/styles/pod.css" type="text/css" />
+ <link rel="next" href="app-docknot-command.html"
+ title="App::DocKnot::Command" />
+ <link rel="up" href="../" title="DocKnot" />
+ <link rel="top" href="../../../" />
+</head>
+
+<!-- Spun by spin %VERSION% on %DATE% -->
+
+<body>
+<table class="navbar"><tr>
+ <td class="navleft"></td>
+ <td>
+ <a href="../../../">Russ Allbery</a>
+ &gt; <a href="../../">Software</a>
+ &gt; <a href="../">DocKnot</a>
+ </td>
+ <td class="navright"><a href="app-docknot-command.html">App::DocKnot::Command</a>&nbsp;&gt;</td>
+</tr></table>
+
+
+<h1>App::DocKnot</h1>
+
+<p class="subhead">(Documentation and software release management)</p>
+
+<p class="navbar">
+ <a href="#S1">Requirements</a>
+ | <a href="#S2">Description</a>
+ | <a href="#S3">Instance Methods</a>
+ | <a href="#S4">Author</a>
+<br />
+ <a href="#S5">Copyright and License</a>
+ | <a href="#S6">See Also</a>
+</p>
+
+<h2 id="S1"><a name="S1">REQUIREMENTS</a></h2>
+
+<p>
+Perl 5.24 or later and the modules File::BaseDir and File::ShareDir, both
+of which are available from CPAN.
+</p>
+
+<h2 id="S2"><a name="S2">DESCRIPTION</a></h2>
+
+<p>
+DocKnot is a system for documentation and software release management.
+Its functionality is provided by various submodules, often invoked via the
+<b>docknot</b> command-line program. For more information, see
+docknot(1).
+</p>
+
+<p>
+This module only provides helper functions to load configuration and
+metadata that are used by its various submodules.
+</p>
+
+<h2 id="S3"><a name="S3">INSTANCE METHODS</a></h2>
+
+<dl>
+<dt>appdata_path(PATH[, ...])</dt>
+<dd><p>
+Return the path of a file from the application data. The file is
+specified as one or more path components.
+</p>
+
+<p>
+These data files are installed with App::DocKnot, but each file can be
+overridden by the user via files in <i class="file">$HOME/.config/docknot</i>
+or <i class="file">/etc/xdg/docknot</i> (or whatever $XDG_CONFIG_HOME and
+$XDG_CONFIG_DIRS are set to). Raises a text exception if the desired file
+could not be located.
+</p></dd>
+</dl>
+
+<h2 id="S4"><a name="S4">AUTHOR</a></h2>
+
+<p>
+Russ Allbery &lt;rra@cpan.org&gt;
+</p>
+
+<h2 id="S5"><a name="S5">COPYRIGHT AND LICENSE</a></h2>
+
+<p>
+Copyright 2013-2021 Russ Allbery &lt;rra@cpan.org&gt;
+</p>
+
+<p>
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+</p>
+
+<p>
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+</p>
+
+<p>
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+</p>
+
+<h2 id="S6"><a name="S6">SEE ALSO</a></h2>
+
+<p>
+docknot(1)
+</p>
+
+<p>
+This module is part of the App-DocKnot distribution. The current version
+of DocKnot is available from CPAN, or directly from its web site at
+&lt;<a href="https://www.eyrie.org/~eagle/software/docknot/">https://www.eyrie.org/~eagle/software/docknot/</a>&gt;.
+</p>
+
+<table class="navbar"><tr>
+ <td class="navleft"></td>
+ <td>
+ <a href="../../../">Russ Allbery</a>
+ &gt; <a href="../../">Software</a>
+ &gt; <a href="../">DocKnot</a>
+ </td>
+ <td class="navright"><a href="app-docknot-command.html">App::DocKnot::Command</a>&nbsp;&gt;</td>
+</tr></table>
+
+<address>
+ Last <a href="https://www.eyrie.org/~eagle/software/web/">spun</a>
+ %DATE% from POD modified %DATE%
+</address>
+</body>
+</html>
diff --git a/t/dist/basic.t b/t/dist/basic.t
index 031dbd1..95a6986 100755
--- a/t/dist/basic.t
+++ b/t/dist/basic.t
@@ -38,8 +38,10 @@ my $distdir = File::Spec->catfile($dir, 'dist');
# Check whether git is available and can be used to initialize a repository.
eval {
- systemx('git', 'init', '-b', 'master', '-q',
- File::Spec->catfile($dir, 'source'));
+ systemx(
+ 'git', 'init', '-b', 'master', '-q',
+ File::Spec->catfile($dir, 'source'),
+ );
};
if ($@) {
plan skip_all => 'git init failed (possibly no git binary)';
diff --git a/t/lib/Test/RRA.pm b/t/lib/Test/RRA.pm
index bb6d6cd..f10137a 100644
--- a/t/lib/Test/RRA.pm
+++ b/t/lib/Test/RRA.pm
@@ -46,7 +46,7 @@ our (@EXPORT_OK, $VERSION);
# consistency is good).
BEGIN {
@EXPORT_OK = qw(
- is_file_contents skip_unless_author skip_unless_automated use_prereq
+ is_file_contents skip_unless_author skip_unless_automated use_prereq
);
# This version should match the corresponding rra-c-util release, but with
diff --git a/t/lib/Test/RRA/Config.pm b/t/lib/Test/RRA/Config.pm
index 5399d5f..232065a 100644
--- a/t/lib/Test/RRA/Config.pm
+++ b/t/lib/Test/RRA/Config.pm
@@ -24,9 +24,9 @@ our (@EXPORT_OK, $VERSION);
# consistency is good).
BEGIN {
@EXPORT_OK = qw(
- $COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH
- $MINIMUM_VERSION %MINIMUM_VERSION @MODULE_VERSION_IGNORE
- @POD_COVERAGE_EXCLUDE @STRICT_IGNORE @STRICT_PREREQ
+ $COVERAGE_LEVEL @COVERAGE_SKIP_TESTS @CRITIC_IGNORE $LIBRARY_PATH
+ $MINIMUM_VERSION %MINIMUM_VERSION @MODULE_VERSION_IGNORE
+ @POD_COVERAGE_EXCLUDE @STRICT_IGNORE @STRICT_PREREQ
);
# This version should match the corresponding rra-c-util release, but with
diff --git a/t/spin/tree.t b/t/spin/tree.t
index bb6c36e..4a92342 100755
--- a/t/spin/tree.t
+++ b/t/spin/tree.t
@@ -13,6 +13,7 @@ use warnings;
use lib 't/lib';
use Capture::Tiny qw(capture_stdout);
+use Cwd qw(getcwd);
use File::Copy::Recursive qw(dircopy);
use File::Spec;
use File::Temp;
@@ -30,6 +31,8 @@ Creating .../software
Spinning .../software/index.html
Creating .../software/docknot
Spinning .../software/docknot/index.html
+Creating .../software/docknot/api
+Running pod2thread for .../software/docknot/api/app-docknot.html
Creating .../usefor
Spinning .../usefor/index.html
Creating .../usefor/drafts
@@ -88,11 +91,19 @@ is(
);
ok(!-e $bogus, 'Stray file and directory was deleted');
-# Copy the input tree to a new temporary directory and regenerate output files
-# with the new timestamps.
+# Copy the input tree to a new temporary directory, replace the rpod pointer,
+# and regenerate output files with the new timestamps.
my $tmpdir = File::Temp->newdir();
dircopy($input, $tmpdir)
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(
+ $tmpdir->dirname, 'software', 'docknot', 'api',
+ 'app-docknot.rpod',
+);
+open($fh, '>', $rpod_path);
+print {$fh} "$rpod_source\n" or die "Cannot write to $rpod_path: $!\n";
+close($fh);
capture_stdout {
$spin->spin_tree($tmpdir->dirname, $output->dirname);
};
diff --git a/t/style/obsolete-strings.t b/t/style/obsolete-strings.t
index c379946..cd028de 100755
--- a/t/style/obsolete-strings.t
+++ b/t/style/obsolete-strings.t
@@ -9,7 +9,7 @@
# The canonical version of this file is maintained in the rra-c-util package,
# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
#
-# Copyright 2016, 2018-2020 Russ Allbery <eagle@eyrie.org>
+# Copyright 2016, 2018-2021 Russ Allbery <eagle@eyrie.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -48,7 +48,7 @@ my @BAD_STRINGS = qw(rra@stanford.edu RRA_MAINTAINER_TESTS);
# File or directory names to always skip.
my %SKIP = map { $_ => 1 } qw(
- .git .pc Changes _build blib changelog cover_db obsolete-strings.t
+ .git .pc Changes _build blib changelog cover_db obsolete-strings.t
);
# Only run this test during automated testing, since failure doesn't indicate