1N/A#!perl -Tw
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A @INC = '../lib';
1N/A}
1N/A
1N/Ause Test::More;
1N/A
1N/Aplan tests => 33;
1N/A
1N/Ause_ok( 'Pod::InputObjects' );
1N/A
1N/A
1N/A{ # test package Pod::InputSource
1N/A local *FH;
1N/A my $p_is = Pod::InputSource->new( -handle => \*FH );
1N/A
1N/A isa_ok( $p_is, 'Pod::InputSource', 'Pod::InputSource constructor' );
1N/A
1N/A is( $p_is->name, '(unknown)', 'Pod::InputSource->name()' );
1N/A is( $p_is->name( 'test' ), 'test', 'set Pod::InputSource->name( test )' );
1N/A is( $p_is->filename, 'test', 'Pod::InputSource->filename() alias' );
1N/A
1N/A is( $p_is->handle, \*FH, 'Pod::InputSource->handle()' );
1N/A
1N/A is( $p_is->was_cutting(), 0, 'Pod::InputSource->was_cutting()' );
1N/A is( $p_is->was_cutting( 1 ), 1, 'set Pod::InputSource->was_cutting( 1 )' );
1N/A}
1N/A
1N/A{ # test package Pod::Paragraph
1N/A my $p_p1 = Pod::Paragraph->new( -text => 'NAME', -name => 'head2' );
1N/A my $p_p2 = Pod::Paragraph->new( 'test - This is the test suite' );
1N/A isa_ok( $p_p1, 'Pod::Paragraph', 'Pod::Paragraph constuctor' );
1N/A isa_ok( $p_p2, 'Pod::Paragraph', 'Pod::Paragraph constructor revisited' );
1N/A
1N/A is( $p_p1->cmd_name(), 'head2', 'Pod::Paragraph->cmd_name()' );
1N/A is( $p_p1->cmd_name( 'head1' ), 'head1',
1N/A 'Pod::Paragraph->cmd_name( head1 )' );
1N/A cmp_ok( $p_p2->cmd_name(), 'eq', '',
1N/A 'Pod::Paragraph->cmd_name() revisited' );
1N/A
1N/A is( $p_p1->text(), 'NAME', 'Pod::Paragraph->text()' );
1N/A is( $p_p2->text(), 'test - This is the test suite',
1N/A 'Pod::Paragraph->text() revisited' );
1N/A my $new_text = 'test - This is the test suite.';
1N/A is( $p_p2->text( $new_text ), $new_text,
1N/A 'Pod::Paragraph->text( ... )' );
1N/A
1N/A is( $p_p1->raw_text, '=head1 NAME',
1N/A 'Pod::Paragraph->raw_text()' );
1N/A is( $p_p2->raw_text, $new_text,
1N/A 'Pod::Paragraph->raw_text() revisited' );
1N/A
1N/A is( $p_p1->cmd_prefix, '=',
1N/A 'Pod::Paragraph->cmd_prefix()' );
1N/A is( $p_p1->cmd_separator, ' ',
1N/A 'Pod::Paragraph->cmd_separator()' );
1N/A
1N/A # Pod::Parser->parse_tree() / ptree()
1N/A
1N/A is( $p_p1->file_line(), '<unknown-file>:0',
1N/A 'Pod::Paragraph->file_line()' );
1N/A $p_p2->{ '-file' } = 'test'; $p_p2->{ '-line' } = 3;
1N/A is( $p_p2->file_line(), 'test:3',
1N/A 'Pod::Paragraph->file_line()' );
1N/A}
1N/A
1N/A{ # test package Pod::InteriorSequence
1N/A
1N/A my $p_pt = Pod::ParseTree->new();
1N/A my $pre_txt = 'test - This is the ';
1N/A my $cmd_txt = 'test suite';
1N/A my $pst_txt ='.';
1N/A $p_pt->append( $cmd_txt );
1N/A
1N/A my $p_is = Pod::InteriorSequence->new(
1N/A -name => 'I', -ldelim => '<', -rdelim => '>',
1N/A -ptree => $p_pt
1N/A );
1N/A isa_ok( $p_is, 'Pod::InteriorSequence', 'P::InteriorSequence constructor' );
1N/A
1N/A is( $p_is->cmd_name(), 'I', 'Pod::InteriorSequence->cmd_name()' );
1N/A is( $p_is->cmd_name( 'B' ), 'B',
1N/A 'set Pod::InteriorSequence->cmd_name( B )' );
1N/A
1N/A is( $p_is->raw_text(), "B<$cmd_txt>",
1N/A 'Pod::InteriorSequence->raw_text()' );
1N/A
1N/A $p_is->prepend( $pre_txt );
1N/A is( $p_is->raw_text(), "B<$pre_txt$cmd_txt>",
1N/A 'raw_text() after prepend()' );
1N/A
1N/A $p_is->append( $pst_txt );
1N/A is( $p_is->raw_text(), "B<$pre_txt$cmd_txt$pst_txt>",
1N/A 'raw_text() after append()' );
1N/A}
1N/A
1N/A{ # test package Pod::ParseTree
1N/A my $p_pt1 = Pod::ParseTree->new();
1N/A my $p_pt2 = Pod::ParseTree->new();
1N/A isa_ok( $p_pt1, 'Pod::ParseTree',
1N/A 'Pod::ParseTree constructor' );
1N/A
1N/A is( $p_pt1->top(), $p_pt1, 'Pod::ParseTree->top()' );
1N/A is( $p_pt1->top( $p_pt1, $p_pt2 ), $p_pt1,
1N/A 'set new Pod::ParseTree->top()' );
1N/A
1N/A ok( eq_array( [ $p_pt1->children() ], [ $p_pt1, $p_pt2] ),
1N/A 'Pod::ParseTree->children()' );
1N/A
1N/A my $text = 'This is the test suite.';
1N/A $p_pt2->append( $text );
1N/A is( $p_pt2->raw_text(), $text, 'Pod::ParseTree->append()' );
1N/A}
1N/A
1N/A__END__
1N/A
1N/A=head1 NAME
1N/A
1N/AInputObjects.t - The tests for Pod::InputObjects
1N/A
1N/A=head AUTHOR
1N/A
1N/A20011220 Abe Timmerman <abe@ztreet.demon.nl>
1N/A
1N/A=cut