Pod-Inherit

 view release on metacpan or  search on metacpan

t/02base.t  view on Meta::CPAN


my $pi_override = Pod::Inherit->new({ input_files => [ 't/lib/OverrideSubClass.pm' ] });
$pi_override->write_pod;
ok(!-e 't/lib/OverrideSubClass.pod', "Doesn't produce unneeded pod for completely overridden base class");


SKIP: {
  skip "Moose not installed", 1 unless Test::JMM::has_moose;
  my $pi_moose = Pod::Inherit->new({ input_files => [ 't/auxlib/MooseSub.pm' ] });
  $pi_moose->write_pod;
  my $output = do { local (@ARGV, $/) = "t/auxlib/MooseSub.pod"; <> || 'NO OUTPUT' };
  $output =~ s/=item L<Moose::Object>\n\n(.+)/=item L<Moose::Object>\n\n(some methods here)/;
  eq_or_diff(
        $output,
        do { local (@ARGV, $/) = "t/baseline/auxlib/MooseSub.pod"; <> || 'NO BASELINE' },
        "MooseSub - Moose extends, existing POD - out_dir unset");
#  ok(!-e 't/lib/MooseSub.pod', "Moose extends, existing POD");
  unlink "t/auxlib/MooseSub.pod";
}

SKIP: {
  skip "Class::C3 not installed", 1 unless Test::JMM::has_c3;
  my $pi_c3 = Pod::Inherit->new({ input_files => [ 't/auxlib/ClassC3Sub.pm' ] });
  $pi_c3->write_pod;
  eq_or_diff(
        do { local (@ARGV, $/) = "t/auxlib/ClassC3Sub.pod";          <> || 'NO OUTPUT' },
        do { local (@ARGV, $/) = "t/baseline/auxlib/ClassC3Sub.pod"; <> || 'NO BASELINE' },
        'ClassC3Sub - "use base" Class::C3 class, existing POD - out_dir unset');
#  ok(!-e 't/lib/ClassC3Sub.pod', '"use base" Class::C3 class, existing POD');
  unlink "t/auxlib/ClassC3Sub.pod";
}

t/04files.t  view on Meta::CPAN

    my $pi = Pod::Inherit->new({
                                input_files => ["t/lib/${class}.pm"],
                                # out_dir     => 't/var/',
                               });

    isa_ok($pi, 'Pod::Inherit');

    $pi->write_pod();

    eq_or_diff(
        do { local (@ARGV, $/) = "t/lib/${class}.pod";            <> || 'NO OUTPUT' },
        do { local (@ARGV, $/) = "t/baseline/files/${class}.pod"; <> || 'NO BASELINE' },
        "$class - $testname - out_dir unset");

    pod_file_ok("t/lib/${class}.pod", "$class - ${testname} - Test::Pod passes - out_dir unset");
    unlink("t/lib/${class}.pod");
}

## Now we test dumping the output to a separate filetree.
foreach my $test (@tests) {
    my ($class, $testname) = @$test;
    Path::Class::Dir->new("t/output/files/")->rmtree;

t/04files.t  view on Meta::CPAN

    isa_ok($pi, 'Pod::Inherit');

    $pi->write_pod();

    # We told it do just this file, and put the output in output/files... so it does.
    my $outpath = "t/output/files/".Path::Class::File->new($class)->basename.".pod";

    ## NB: "scalar" forces a result in list context, otherwise we get
    ## crazy arguments to eq_or_diff
    eq_or_diff(
               do { local (@ARGV, $/) = $outpath;                        <> || 'NO OUTPUT' },
               do { local (@ARGV, $/) = "t/baseline/files/${class}.pod"; <> || 'NO BASELINE' },
               "$class - $testname - out_dir set");

    pod_file_ok($outpath, "$class - ${testname} - Test::Pod passes - out_dir set");
}

Path::Class::Dir->new("t/output/files/")->rmtree;

t/05not_ours.t  view on Meta::CPAN

use Test::More 'no_plan';
use Test::Differences;
use Test::Warn;

use lib 't/lib';
my $pi = Pod::Inherit->new({
                            input_files => 't/lib/not_ours.pm',
                           });
warning_like {$pi->write_pod();}
  qr/not_ours\.pod already exists, and it doesn't look like we generated it\.  Skipping this file/, "Got the warning";
my $orig = do {local (@ARGV, $/) = "t/lib/not_ours.pod"; scalar <>};
eq_or_diff(do {local (@ARGV, $/) = "t/lib/not_ours.pod"; scalar <>},
           $orig,
           "output file doesn't begin with our autogen marker");

t/06dir.t  view on Meta::CPAN

                            out_dir => $dir,
                           });

isa_ok($pi, 'Pod::Inherit');
$pi->write_pod();

sub check_file {
  my ($outfile) = @_;
  (my $blfile = $outfile) =~ s!output!baseline!;

  eq_or_diff(do {local (@ARGV, $/) = $outfile; scalar <> || 'NO OUTPUT?'},
             do {local (@ARGV, $/) = $blfile;  scalar <> || 'NO BASELINE'},
             "Running on directory: $outfile");
  pod_file_ok($outfile, "Running on directory: $outfile - Test::Pod");
}

# Check that for each output file, it matches the baseline file...
my @todo = $dir;
while (@todo) {
  $_ = shift @todo;
  if (-d $_) {
    push @todo, glob("$_/*");

t/06dir.t  view on Meta::CPAN

    ok(-e $outfile, "baseline file $_ has matching output");
  }
}

## test lack of foo.txt in output dir


# foreach my $outfile (<t/output/files/*.pod>) {
#   my $origfile = Path::Class::Dir->new("t/baseline")->file(Path::Class::File->new($outfile)->basename);

#   eq_or_diff( do { local (@ARGV, $/) = "$outfile"; scalar <> },
#               do { local (@ARGV, $/) = "$origfile"; scalar <> },
#               "Running on directory: $outfile - matches");

#   pod_file_ok("$outfile", "Running on directory: $outfile - Test::Pod passes");
# }

# ## should we do this with no out_dir as well?

$dir->rmtree;

t/07options.t  view on Meta::CPAN

  method_format   => 'L<%m|%c/%m>'
});

isa_ok($pi, 'Pod::Inherit');
$pi->write_pod();

sub check_file {
  my ($outfile) = @_;
  (my $blfile = $outfile) =~ s!output!baseline!;

  eq_or_diff(do {local (@ARGV, $/) = $outfile; scalar <> || 'NO OUTPUT?'},
             do {local (@ARGV, $/) = $blfile;  scalar <> || 'NO BASELINE'},
             "Running on directory: $outfile");
  pod_file_ok($outfile, "Running on directory: $outfile - Test::Pod");
}

# Check that for each output file, it matches the baseline file...
my @todo = $dir;
while (@todo) {
  $_ = shift @todo;
  if (-d $_) {
    push @todo, glob("$_/*");

t/08dead_links.t  view on Meta::CPAN

  method_format   => 'L<%m|%c/%m>',
});

isa_ok($pi, 'Pod::Inherit');
$pi->write_pod();

sub check_file {
  my ($outfile) = @_;
  (my $blfile = $outfile) =~ s!output!baseline!;

  eq_or_diff(do {local (@ARGV, $/) = $outfile; scalar <> || 'NO OUTPUT?'},
             do {local (@ARGV, $/) = $blfile;  scalar <> || 'NO BASELINE'},
             "Running on directory: $outfile");
  pod_file_ok($outfile, "Running on directory: $outfile - Test::Pod");
}

# Check that for each output file, it matches the baseline file...
my @todo = $dir;
while (@todo) {
  $_ = shift @todo;
  if (-d $_) {
    push @todo, glob("$_/*");



( run in 0.588 second using v1.01-cache-2.11-cpan-49f99fa48dc )