diff options
author | Abe Timmerman <abe@ztreet.demon.nl> | 2002-02-21 01:20:40 +0100 |
---|---|---|
committer | Abhijit Menon-Sen <ams@wiw.org> | 2002-02-20 22:27:20 +0000 |
commit | 8513cbdf106cab43f9742e6b987ad9130ef5d44e (patch) | |
tree | a3d83788fad0ae4f14e10b462373c91af8398dc8 /lib/Pod | |
parent | 36fec512d0f14b1b52f266589c60192b619fa2ff (diff) | |
download | perl-8513cbdf106cab43f9742e6b987ad9130ef5d44e.tar.gz |
Re: Make Schwern poor in just 20 easy steps!
Message-Id: <dgb87ukjfanphg45i4skobhe40s1g4sujj@4ax.com>
p4raw-link: @4 on //depot/thrperl: 11343788cbaaede18e3146b5219d2fbdaeaf516e
p4raw-id: //depot/perl@14801
Diffstat (limited to 'lib/Pod')
-rw-r--r-- | lib/Pod/t/Select.t | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/lib/Pod/t/Select.t b/lib/Pod/t/Select.t new file mode 100644 index 0000000000..27ef010394 --- /dev/null +++ b/lib/Pod/t/Select.t @@ -0,0 +1,116 @@ +#!perl +use warnings; +use strict; + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +}; + +use Test::More tests => 9; + +require_ok( 'Pod::Select' ); + +my $fake_out = tie *FAKEOUT, 'CatchOut'; + +my $p_s = Pod::Select->new; +isa_ok( $p_s, 'Pod::Select' ); + +my $pod = << 'EO_NAME'; +=head1 NAME + +Select.t - Tests for Pod::Select. + +EO_NAME + +$p_s->select( 'NAME' ); +$p_s->parse_from_file( $0, \*FAKEOUT ); +is( $$fake_out, $pod, 'select( NAME )' ); + +$pod .= << 'EO_SYNOPSIS'; +=head1 SYNOPSIS + +This program just tests the basics of the Pod::Select module. + +EO_SYNOPSIS + +$$fake_out = ''; +$p_s->select( 'NAME', 'SYNOPSIS' ); +$p_s->parse_from_file( $0, \*FAKEOUT ); +is( $$fake_out, $pod, 'select( NAME, SYNOPSIS )' ); + +$pod .= << 'EO_AUTHOR'; +=head1 AUTHOR + +Abe Timmerman <abe@ztreet.demon.nl> + +EO_AUTHOR + +$$fake_out = ''; +$p_s->add_selection( 'AUTHOR' ); +$p_s->parse_from_file( $0, \*FAKEOUT ); +is( $$fake_out, $pod, 'add_selection( AUTHOR )' ); + +my $head1 = $p_s->curr_headings(1); +is( $head1, 'AUTHOR', 'curr_headings()' ); + +$pod = << 'EO_DESCRIPTION'; +=head2 subsection + +a sub-section can be specified + +EO_DESCRIPTION + +$$fake_out = ''; +$p_s->select( 'DESCRIPTION/subsection' ); +$p_s->parse_from_file( $0, \*FAKEOUT ); +is( $$fake_out, $pod, 'select( DESCRIPTION/subsection )' ); + + +ok( $p_s->match_section( 'DESCRIPTION', 'subsection' ), + 'match_section( DESCRIPTION, subsection )' ); + +$pod = << 'EO_DESCRIPTION'; +=head1 DESCRIPTION + +I'll go by the POD in Pod::Select. + +EO_DESCRIPTION + +$$fake_out = ''; +$p_s->select( 'DESCRIPTION/!.+' ); +$p_s->parse_from_file( $0, \*FAKEOUT ); +is( $$fake_out, $pod, 'select( DESCRIPTION/!.+ )' ); + + +package CatchOut; +sub TIEHANDLE { bless \( my $self ), shift } +sub PRINT { my $self = shift; $$self .= $_[0] } + +__END__ + +=head1 NAME + +Select.t - Tests for Pod::Select. + +=head1 SYNOPSIS + +This program just tests the basics of the Pod::Select module. + +=head1 DESCRIPTION + +I'll go by the POD in Pod::Select. + +=head2 selection + add_selection + +Pull out the specified sections + +=head2 subsection + +a sub-section can be specified + +=head1 AUTHOR + +Abe Timmerman <abe@ztreet.demon.nl> + +=cut |