6 if ($^O eq 'MSWin32') {
7 plan skip_all => "Not portable on Win32\n";
12 use_ok ("Pod::Usage");
18 my $pid = open(IN, "-|");
19 unless(defined $pid) {
20 die "Cannot fork: $!";
29 print "#EXIT=$exit OUTPUT=+++#@out#+++\n";
30 return($exit, join("",@out));
33 open(STDERR, ">&STDOUT");
35 print "--NORMAL-RETURN--\n";
41 my ($left,$right) = @_;
42 $left =~ s/^#\s+/#/gm;
43 $right =~ s/^#\s+/#/gm;
49 my ($exit, $text) = getoutput( sub { pod2usage() } );
50 is ($exit, 2, "Exit status pod2usage ()");
51 ok (compare ($text, <<'EOT'), "Output test pod2usage ()");
53 # frobnicate [ -r | --recursive ] [ -f | --force ] file ...
57 ($exit, $text) = getoutput( sub { pod2usage(
58 -message => 'You naughty person, what did you say?',
60 is ($exit, 1, "Exit status pod2usage (-message => '...', -verbose => 1)");
61 ok (compare ($text, <<'EOT'), "Output test pod2usage (-message => '...', -verbose => 1)");
62 #You naughty person, what did you say?
64 # frobnicate [ -r | --recursive ] [ -f | --force ] file ...
74 # Specify number of frobs, default is 42.
78 ($exit, $text) = getoutput( sub { pod2usage(
79 -verbose => 2, -exit => 42 ) } );
80 is ($exit, 42, "Exit status pod2usage (-verbose => 2, -exit => 42)");
81 ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 2, -exit => 42)");
83 # frobnicate - do what I mean
86 # frobnicate [ -r | --recursive ] [ -f | --force ] file ...
89 # frobnicate does foo and bar and what not.
99 # Specify number of frobs, default is 42.
103 ($exit, $text) = getoutput( sub { pod2usage(0) } );
104 is ($exit, 0, "Exit status pod2usage (0)");
105 ok (compare ($text, <<'EOT'), "Output test pod2usage (0)");
107 # frobnicate [ -r | --recursive ] [ -f | --force ] file ...
117 # Specify number of frobs, default is 42.
121 ($exit, $text) = getoutput( sub { pod2usage(42) } );
122 is ($exit, 42, "Exit status pod2usage (42)");
123 ok (compare ($text, <<'EOT'), "Output test pod2usage (42)");
125 # frobnicate [ -r | --recursive ] [ -f | --force ] file ...
129 ($exit, $text) = getoutput( sub { pod2usage(-verbose => 0, -exit => 'NOEXIT') } );
130 is ($exit, 0, "Exit status pod2usage (-verbose => 0, -exit => 'NOEXIT')");
131 ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 0, -exit => 'NOEXIT')");
133 # frobnicate [ -r | --recursive ] [ -f | --force ] file ...
138 ($exit, $text) = getoutput( sub { pod2usage(-verbose => 99, -sections => 'DESCRIPTION') } );
139 is ($exit, 1, "Exit status pod2usage (-verbose => 99, -sections => 'DESCRIPTION')");
140 ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 99, -sections => 'DESCRIPTION')");
142 # frobnicate does foo and bar and what not.
152 frobnicate - do what I mean
156 B<frobnicate> S<[ B<-r> | B<--recursive> ]> S<[ B<-f> | B<--force> ]>
161 B<frobnicate> does foo and bar and what not.
167 =item B<-r> | B<--recursive>
171 =item B<-f> | B<--force>
177 Specify number of frobs, default is 42.