Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test the pod text attribute when testing file doc
  • Loading branch information
rwstauner committed Dec 14, 2014
1 parent af93eb8 commit 2832cb6
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion t/document/file.t
Expand Up @@ -46,7 +46,13 @@ sub test_attributes {
my ( $obj, $att ) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
foreach my $key ( sort keys %$att ) {
is_deeply $obj->$key, $att->{$key}, $key;
my $got = $obj->$key;
if ( $key eq 'pod' ) {

# Dereference scalar to compare strings.
$got = $$got;
}
is_deeply $got, $att->{$key}, $key;
}
}

Expand Down Expand Up @@ -86,6 +92,12 @@ END
is_deeply( $file->pod_lines, [ [ 3, 12 ], [ 18, 6 ] ] );
is( $file->sloc, 3 );
is( $file->slop, 11 );

is(
${ $file->pod },
q[NAME MyModule - mymodule1 abstract not this bla SYNOPSIS more pod more even more],
'pod text'
);
};

subtest 'just pod' => sub {
Expand All @@ -106,6 +118,7 @@ END
sloc => 0,
slop => 2,
pod_lines => [ [ 1, 3 ] ],
pod => q[NAME MyModule],
};
};

Expand All @@ -132,6 +145,7 @@ END
sloc => 0,
slop => 4,
pod_lines => [ [ 2, 7 ] ],
pod => q[NAME Script - a command line tool VERSION Version 0.5.0],
};
};

Expand Down Expand Up @@ -179,6 +193,7 @@ END
sloc => 1,
slop => 7,
pod_lines => [ [ 2, 8 ], [ 12, 3 ] ],
pod => q[NAME MOBY::Config.pm - An object B<containing> information about how to get access to teh Moby databases, resources, etc. from the mobycentral.config file USAGE],
};
};

Expand Down Expand Up @@ -237,6 +252,12 @@ END
is_deeply( $file->pod_lines, [ [ 18, 7 ] ], 'correct pod_lines' );
is( $file->module->[0]->version_numified,
1.1, 'numified version has been calculated' );

is(
${ $file->pod },
q[NAME Number::Phone::NANP::AS AS-specific methods for Number::Phone],
'pod text'
);
};

subtest 'hidden package' => sub {
Expand All @@ -263,6 +284,8 @@ END
sloc => 2,
slop => 2,
pod_lines => [ [ 3, 3 ], ],
pod =>
q[NAME "Perl6Attribute" -- An example attribute metaclass for Perl 6 style attributes],
};
};

Expand Down Expand Up @@ -309,6 +332,8 @@ END
sloc => 1,
slop => 10,
pod_lines => [ [ 6, 19 ], ],
pod =>
q[NAME Foo -- An example attribute metaclass for Perl 6 style attributes DESCRIPTION hot stuff * Foo * Bar],
};
};

Expand Down Expand Up @@ -354,6 +379,7 @@ END
sloc => 1,
slop => 8,
pod_lines => [ [ 2, 15 ], ],
pod => q[DESCRIPTION hot stuff * Foo * Bar],
};
}
};
Expand Down Expand Up @@ -398,6 +424,8 @@ END
sloc => 3,
slop => 12,
pod_lines => [ [ 4, 17 ], ],
pod =>
q[Something some paragraph .. Fully qualified subroutine names are also supported. For example, __DATA__ sub foo::bar {23} package baz; sub dob {32} will all be loaded correctly by the SelfLoader, and the SelfLoader will ensure that the packages 'foo' and 'baz' correctly have the SelfLoader "AUTOLOAD" method when the data after "__DATA__" is first parsed.],
};
};

Expand Down

0 comments on commit 2832cb6

Please sign in to comment.