From: Steve Peters Date: Thu, 8 Dec 2005 19:04:59 +0000 (+0000) Subject: Further yak-shaving on Pod::Usage. Now, t/pod/pod2usage2.t tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ce6e48f380e7ead67a463a86546c4ac2012ab015;p=p5sagit%2Fp5-mst-13.2.git Further yak-shaving on Pod::Usage. Now, t/pod/pod2usage2.t tests pass. p4raw-id: //depot/perl@26304 --- diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm index eee915e..ed4b81d 100644 --- a/lib/Pod/Usage.pm +++ b/lib/Pod/Usage.pm @@ -594,9 +594,11 @@ sub seq_i { return $_[1] } # Note that the below is very, very specific to Pod::Text. sub _handle_element_end { my ($self, $element) = @_; - if ($element eq 'head1' && $self->{USAGE_OPTIONS}->{-verbose} < 2) { + if ($element eq 'head1') { $$self{USAGE_HEAD1} = $$self{PENDING}[-1][1]; - $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/; + if ($self->{USAGE_OPTIONS}->{-verbose} < 2) { + $$self{PENDING}[-1][1] =~ s/^\s*SYNOPSIS\s*$/USAGE/; + } } elsif ($element eq 'head2') { $$self{USAGE_HEAD2} = $$self{PENDING}[-1][1]; } diff --git a/t/pod/pod2usage2.t b/t/pod/pod2usage2.t index 4bdaaee..5006a7c 100644 --- a/t/pod/pod2usage2.t +++ b/t/pod/pod2usage2.t @@ -50,7 +50,7 @@ my ($exit, $text) = getoutput( sub { pod2usage() } ); is ($exit, 2, "Exit status pod2usage ()"); ok (compare ($text, <<'EOT'), "Output test pod2usage ()"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # EOT @@ -61,7 +61,7 @@ is ($exit, 1, "Exit status pod2usage (-message => '...', -verbos ok (compare ($text, <<'EOT'), "Output test pod2usage (-message => '...', -verbose => 1)"); #You naughty person, what did you say? # Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # Options: # -r | --recursive @@ -83,7 +83,7 @@ ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 2, -exit => 42 # frobnicate - do what I mean # # SYNOPSIS -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # DESCRIPTION # frobnicate does foo and bar and what not. @@ -104,7 +104,7 @@ EOT is ($exit, 0, "Exit status pod2usage (0)"); ok (compare ($text, <<'EOT'), "Output test pod2usage (0)"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # Options: # -r | --recursive @@ -122,7 +122,7 @@ EOT is ($exit, 42, "Exit status pod2usage (42)"); ok (compare ($text, <<'EOT'), "Output test pod2usage (42)"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # EOT @@ -130,7 +130,7 @@ EOT is ($exit, 0, "Exit status pod2usage (-verbose => 0, -exit => 'NOEXIT')"); ok (compare ($text, <<'EOT'), "Output test pod2usage (-verbose => 0, -exit => 'NOEXIT')"); #Usage: -# frobnicate [ -r | --recursive ] [ -f | --force ] [ -n number ] file ... +# frobnicate [ -r | --recursive ] [ -f | --force ] file ... # # --NORMAL-RETURN-- EOT @@ -154,7 +154,7 @@ frobnicate - do what I mean =head1 SYNOPSIS B S<[ B<-r> | B<--recursive> ]> S<[ B<-f> | B<--force> ]> - S<[ B<-n> I ]> I ... + file ... =head1 DESCRIPTION @@ -172,7 +172,7 @@ Run recursively. Just do it! -=item B<-n> I +=item B<-n> number Specify number of frobs, default is 42.