App-DocKnot
view release on metacpan or search on metacpan
t/cli/spin.t view on Meta::CPAN
# Spin a tree of files.
$expected = $datadir->child('output');
capture_stdout {
$docknot->run('spin', '-s', '/~eagle/styles', "$indir", "$tempdir");
};
my $count = is_spin_output_tree($tempdir, $expected, 'spin');
# Spin a file with warnings. The specific warnings are checked in
# t/spin/errors.t; here, we just check the rewrite of the warning.
my $errors = $datadir->child('errors', 'errors.th')->realpath();
my $stderr;
($stdout, $stderr) = capture {
$docknot->run('spin-thread', "$errors");
};
like(
$stderr, qr{ \A \Q$0\E [ ] spin-thread : \Q$errors\E : 1 : }xms,
'warnings are properly rewritten',
);
# Report the end of testing.
done_testing($count + 6);
t/spin/errors.t view on Meta::CPAN
errors.th:16: no sitemap file found
errors.th:17: no package version information available
errors.th:17: cannot stat file nonexistent-file
ERRORS
require_ok('App::DocKnot::Spin::Thread');
# Spin the errors file with output captured.
my $input = path('t', 'data', 'spin', 'errors', 'errors.th');
my $spin = App::DocKnot::Spin::Thread->new();
my ($stdout, $stderr) = capture {
$spin->spin_thread_file($input);
};
# Simplify the file name and search prefix, and then check against the
# expected output.
$stderr =~ s{ ^ [^:]+/errors[.]th: }{errors.th:}xmsg;
$stderr =~ s{ (cannot [ ] stat [ ] file [ ]) /[^:]+/([^/:]+) : .* }{$1$2\n}xms;
$stderr =~ s{ (prefix: [ ]) \"[^\"]+\", }{$1<PREFIX>,}xms;
is($stderr, $EXPECTED_ERRORS, 'errors are correct');
( run in 0.671 second using v1.01-cache-2.11-cpan-26ccb49234f )