NAME

Test::DocKnot::Spin - Helper functions for testing spin

SYNOPSIS

use Test::DocKnot::Spin qw(is_spin_output);

$spin->spin_file($input, $output);
is_spin_output($output, $expected, 'Check a single file');

$spin->spin_tree($input_path, $output_path);
is_spin_output_tree($output_path, $expected_path, 'Check a tree');

DESCRIPTION

This module collects utility functions that are useful for testing the App::DocKnot::Spin module.

This module must be loaded before Test::More or it will abort during import.

FUNCTIONS

None of these functions are imported by default. The ones used by a script should be explicitly imported.

fix_pointers(TREE, BASE)

Find all *.spin pointer files in TREE, treat any relative paths found in those pointer files as if they were relative to BASE, convert them to absolute paths, and write out the modified pointer file. This is intended to be used after copying an input tree for App::DocKnot::Spin to a temporary directory, which would otherwise break any relative paths in pointer files.

is_spin_output(OUTPUT, EXPECTED, MESSAGE)

Given OUTPUT, which should be a Path::Tiny object pointing to the output from App::DocKnot::Spin, compare it to the expected output in the file named EXPECTED (also a Path::Tiny object). MESSAGE is the message to print with the test results for easy identification.

is_spin_output_tree(OUTPUT, EXPECTED, MESSAGE)

Compare the output tree at OUTPUT with the expected output tree at EXPECTED (both Path::Tiny objects), using the same comparison algorithm as is_spin_output() for HTML and RSS files and a straight content comparison for all other files. MESSAGE with the message to print with the test results for easy identification.

AUTHOR

Russ Allbery <rra@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2021-2024 Russ Allbery <rra@cpan.org>

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.

SEE ALSO

App::DocKnot::Spin

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 https://www.eyrie.org/~eagle/software/docknot/.