App-DocKnot

 view release on metacpan or  search on metacpan

t/cli/errors.t  view on Meta::CPAN

# Tests for the App::DocKnot command dispatch error handling.
#
# Copyright 2018-2021 Russ Allbery <rra@cpan.org>
#
# SPDX-License-Identifier: MIT

use 5.024;
use autodie;
use warnings;

use POSIX qw(LC_ALL setlocale);
use Test::More tests => 11;

# Isolate from the environment.
setlocale(LC_ALL, 'C');
local $ENV{XDG_CONFIG_HOME} = '/nonexistent';
local $ENV{XDG_CONFIG_DIRS} = '/nonexistent';

# Load the module.
BEGIN { use_ok('App::DocKnot::Command') }

# Check an error against the expected message, removing the trailing newline
# and stripping off the leading $0 that's prepended and the colon and space
# directly following it, if any.
#

t/cli/spin.t  view on Meta::CPAN


use 5.024;
use autodie;
use warnings;

use lib 't/lib';

use Capture::Tiny qw(capture capture_stdout);
use File::Copy::Recursive qw(dircopy);
use Path::Tiny qw(path);
use POSIX qw(LC_ALL setlocale);
use Test::DocKnot::Spin qw(fix_pointers is_spin_output is_spin_output_tree);

use Test::More;

# Load the modules.
BEGIN {
    use_ok('App::DocKnot::Command');
    use_ok('App::DocKnot::Util', qw(print_fh));
}

# Force the C locale because some of the output intentionally uses localized
# month names and we have to force those to English for comparison of test
# results.
setlocale(LC_ALL, 'C');

# Create the command-line parser.
my $docknot = App::DocKnot::Command->new();
isa_ok($docknot, 'App::DocKnot::Command');

# Create a temporary directory for test output.
my $tempdir = Path::Tiny->tempdir();

# Spin a single file.
my $datadir = path('t', 'data', 'spin');

t/spin/tree.t  view on Meta::CPAN


use 5.024;
use autodie;
use warnings;

use lib 't/lib';

use Capture::Tiny qw(capture_stdout);
use File::Copy::Recursive qw(dircopy);
use Path::Tiny qw(path);
use POSIX qw(LC_ALL setlocale strftime);
use Test::DocKnot::Spin qw(fix_pointers is_spin_output_tree);

use Test::More;

# Force the C locale because some of the output intentionally uses localized
# month names and we have to force those to English for comparison of test
# results.
setlocale(LC_ALL, 'C');

# Expected output when spinning our tree of input files.
my $EXPECTED_OUTPUT = <<'OUTPUT';
Generating thread file .../changes.th
Generating RSS file .../changes.rss
Generating index file .../journal/index.th
Generating RSS file .../journal/index.rss
Generating RSS file .../journal/debian.rss
Generating RSS file .../journal/reviews.rss
Updating .../changes.rss



( run in 0.985 second using v1.01-cache-2.11-cpan-ceb78f64989 )