App-podweaver
view release on metacpan or search on metacpan
t/30-weave-file.t view on Meta::CPAN
#!perl
use warnings;
use strict;
use Test::More;
use Test::MockObject;
use Test::Differences;
use File::Copy;
use File::Spec;
use File::Temp;
use Pod::Elemental::Selectors -all;
use Pod::Elemental::Transformer::Nester;
use Pod::Elemental::Transformer::Pod5;
use Software::License::Perl_5;
use App::podweaver;
my @tests = (
# POD END DATA UNCHANGED
[ qw/no no no/, 0 ],
[ qw/block no no/, 0 ],
[ qw/interlaced no no/, 0 ],
[ qw/no with no/, 0 ],
[ qw/block-before with no/, 1 ],
[ qw/block-after with no/, 1 ],
[ qw/interlaced with no/, 0 ],
[ qw/no no with/, 0 ],
[ qw/block no with/, 1 ],
[ qw/interlaced no with/, 0 ],
);
my $tests_per_test = 7;
my $extra_tests_for_changed = 1;
my $test_files = 't/test_files/30-weave-file';
plan tests => (
( scalar( @tests ) * $tests_per_test ) +
( scalar( grep { !$_->[ 3 ] } @tests ) * $extra_tests_for_changed )
);
my ( $mock_weaver, $weaver_args );
$mock_weaver = Test::MockObject->new();
$mock_weaver->set_isa( 'Pod::Weaver' );
$mock_weaver->mock( 'weave_document',
sub
{
$weaver_args = $_[ 1 ];
# Normalize the Pod so that we can compare it more easily.
# Possibly defeats some of the point of mocking the object by
# making it sensitive to upstream changes.
if( $_[ 1 ]->{ pod_document } )
{
Pod::Elemental::Transformer::Pod5->new->transform_node(
$_[ 1 ]->{ pod_document } );
my $nester = Pod::Elemental::Transformer::Nester->new( {
top_selector => s_command( [ qw(head1) ] ),
content_selectors => [
s_flat,
s_command( [ qw(head2 head3 head4 over item back) ]),
],
} );
$nester->transform_node( $_[ 1 ]->{ pod_document } );
}
( run in 0.849 second using v1.01-cache-2.11-cpan-6aa56a78535 )