| 1 | #!perl -Tw
|
|---|
| 2 |
|
|---|
| 3 | BEGIN {
|
|---|
| 4 | chdir 't' if -d 't';
|
|---|
| 5 | @INC = '../lib';
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | use Test::More;
|
|---|
| 9 |
|
|---|
| 10 | plan tests => 33;
|
|---|
| 11 |
|
|---|
| 12 | use_ok( 'Pod::InputObjects' );
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | { # test package Pod::InputSource
|
|---|
| 16 | local *FH;
|
|---|
| 17 | my $p_is = Pod::InputSource->new( -handle => \*FH );
|
|---|
| 18 |
|
|---|
| 19 | isa_ok( $p_is, 'Pod::InputSource', 'Pod::InputSource constructor' );
|
|---|
| 20 |
|
|---|
| 21 | is( $p_is->name, '(unknown)', 'Pod::InputSource->name()' );
|
|---|
| 22 | is( $p_is->name( 'test' ), 'test', 'set Pod::InputSource->name( test )' );
|
|---|
| 23 | is( $p_is->filename, 'test', 'Pod::InputSource->filename() alias' );
|
|---|
| 24 |
|
|---|
| 25 | is( $p_is->handle, \*FH, 'Pod::InputSource->handle()' );
|
|---|
| 26 |
|
|---|
| 27 | is( $p_is->was_cutting(), 0, 'Pod::InputSource->was_cutting()' );
|
|---|
| 28 | is( $p_is->was_cutting( 1 ), 1, 'set Pod::InputSource->was_cutting( 1 )' );
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | { # test package Pod::Paragraph
|
|---|
| 32 | my $p_p1 = Pod::Paragraph->new( -text => 'NAME', -name => 'head2' );
|
|---|
| 33 | my $p_p2 = Pod::Paragraph->new( 'test - This is the test suite' );
|
|---|
| 34 | isa_ok( $p_p1, 'Pod::Paragraph', 'Pod::Paragraph constuctor' );
|
|---|
| 35 | isa_ok( $p_p2, 'Pod::Paragraph', 'Pod::Paragraph constructor revisited' );
|
|---|
| 36 |
|
|---|
| 37 | is( $p_p1->cmd_name(), 'head2', 'Pod::Paragraph->cmd_name()' );
|
|---|
| 38 | is( $p_p1->cmd_name( 'head1' ), 'head1',
|
|---|
| 39 | 'Pod::Paragraph->cmd_name( head1 )' );
|
|---|
| 40 | ok( !$p_p2->cmd_name(),
|
|---|
| 41 | 'Pod::Paragraph->cmd_name() revisited' );
|
|---|
| 42 |
|
|---|
| 43 | is( $p_p1->text(), 'NAME', 'Pod::Paragraph->text()' );
|
|---|
| 44 | is( $p_p2->text(), 'test - This is the test suite',
|
|---|
| 45 | 'Pod::Paragraph->text() revisited' );
|
|---|
| 46 | my $new_text = 'test - This is the test suite.';
|
|---|
| 47 | is( $p_p2->text( $new_text ), $new_text,
|
|---|
| 48 | 'Pod::Paragraph->text( ... )' );
|
|---|
| 49 |
|
|---|
| 50 | is( $p_p1->raw_text, '=head1 NAME',
|
|---|
| 51 | 'Pod::Paragraph->raw_text()' );
|
|---|
| 52 | is( $p_p2->raw_text, $new_text,
|
|---|
| 53 | 'Pod::Paragraph->raw_text() revisited' );
|
|---|
| 54 |
|
|---|
| 55 | is( $p_p1->cmd_prefix, '=',
|
|---|
| 56 | 'Pod::Paragraph->cmd_prefix()' );
|
|---|
| 57 | is( $p_p1->cmd_separator, ' ',
|
|---|
| 58 | 'Pod::Paragraph->cmd_separator()' );
|
|---|
|
|---|