File: 02_clean.t

package info (click to toggle)
libmodule-install-readmefrompod-perl 0.30-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 272 kB
  • sloc: perl: 1,735; sh: 6; makefile: 2
file content (81 lines) | stat: -rw-r--r-- 2,472 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use strict;
use warnings;
use Test::More; #tests => 1;
use File::Temp      qw[tempdir];
use File::Path      qw[rmtree];
use Capture::Tiny   qw[capture_merged];
use Config;
use IO::All -binary;

unless ( -e 'have_make' ) {
  plan skip_all => 'No network tests';
}

plan tests => 13;

{
my $make = $Config{make};
mkdir 'dist';
my $tmpdir = tempdir( DIR => 'dist', CLEANUP => 1 );
chdir $tmpdir or die "$!\n";
io->file('README.pm')->print(<<README);
=head1 NAME

Foo::Bar - Putting the Foo into Bar

=head1 DESCRIPTION

It is like chocolate, but not.

=cut
README
io->file('Makefile.PL')->print(<<EOF);
use if ! ( grep { \$_ eq '.' } \@INC ), qw[lib .];
use strict;
use inc::Module::Install;
name 'Foo-Bar';
version '0.01';
author 'Foo Bar';
abstract 'This module does something';
license 'perl';
my \@options;
\@options = ( 'sentence' => 0, 'width' => 20 );
readme_from 'README.pm' => 'clean', 'text', 'Foobar.txt', \@options;
\@options = ( '--backlink', '--flush' );
readme_from 'README.pm' => 'clean', 'html', 'Foobar.htm', \@options;
\@options = ( 'perldoc_url_prefix' => 'metacpan' );
readme_from 'README.pm' => 'clean', 'md', 'Foobar.md', \@options;
\@options = ( 'release' => 1.03, 'section' => 8 );
readme_from 'README.pm', { clean => 1, format => 'man', output_file => 'Foobar.man', options => \\\@options };
WriteAll;
EOF
my $merged = capture_merged { system "$^X Makefile.PL" };
diag("$merged");
# Copied /usr/lib/perl5/site_perl/5.8.8/Devel/CheckOS.pm to
#        inc/Devel/CheckOS.pm
# Copied /usr/lib/perl5/site_perl/5.8.8/Devel/AssertOS.pm to
#        inc/Devel/AssertOS.pm
# Copied /usr/lib/perl5/site_perl/5.8.8/Devel/AssertOS/NetBSD.pm to
#        inc/Devel/AssertOS/NetBSD.pm
my @tests = (
'inc/Module/Install/ReadmeFromPod.pm',
);
ok( -e $_, "Exists: '$_'" ) for @tests;
ok( -e 'Foobar.txt', 'There is a Foobar.txt file' );
ok( -e 'Foobar.htm', 'There is a Foobar.htm file' );
ok( -e 'Foobar.md', 'There is a Foobar.md file' );
ok( -e 'Foobar.man', 'There is a Foobar.man file' );

unlike io->file($_)->all, qr/\r\n/, "$_ contains only unix newlines"
  for qw( Foobar.txt Foobar.htm Foobar.md Foobar.man );

my $distclean = capture_merged { system "$make distclean" };
diag("$distclean");

ok( !-e 'Foobar.txt', 'The Foobar.txt file has been removed' );
ok( !-e 'Foobar.htm', 'The Foobar.htm file has been removed' );
ok( !-e 'Foobar.md', 'The Foobar.md file has been removed' );
ok( !-e 'Foobar.man', 'The Foobar.man file has been removed' );

}
exit 0;