1#!/usr/bin/perl 2 3use strict; 4use warnings; 5 6use lib 't/lib'; 7use ExtUtils::MakeMaker; 8use File::Temp qw[tempfile]; 9use Test::More 'no_plan'; 10 11sub test_abstract { 12 my($code, $package, $want, $name) = @_; 13 14 local $Test::Builder::Level = $Test::Builder::Level + 1; 15 16 my ($fh,$file) = tempfile( DIR => 't', UNLINK => 1 ); 17 print $fh $code; 18 close $fh; 19 20 # Hack up a minimal MakeMaker object. 21 my $mm = bless { DISTNAME => $package }, "MM"; 22 my $have = $mm->parse_abstract($file); 23 24 my $ok = is( $have, $want, $name ); 25 26 return $ok; 27} 28 29 30test_abstract(<<END, "Foo", "Stuff and things", "Simple abstract"); 31=head1 NAME 32 33Foo - Stuff and things 34END 35 36 37test_abstract(<<END, "NEXT", "Provide a pseudo-class NEXT (et al) that allows method redispatch", "Name.pm"); 38=head1 NAME 39 40NEXT.pm - Provide a pseudo-class NEXT (et al) that allows method redispatch 41END 42 43 44test_abstract(<<END, "Compress::Raw::Zlib::FAQ", "Frequently Asked Questions about Compress::Raw::Zlib", "double dash"); 45=pod 46 47Compress::Raw::Zlib::FAQ -- Frequently Asked Questions about Compress::Raw::Zlib 48END 49 50 51test_abstract(<<END, "Foo", "This is", "Only in POD"); 52# =pod 53 54Foo - This is not in pod 55 56=cut 57 58Foo - This isn't in pod either 59 60=pod 61 62Foo - This is 63 64Foo - So is this. 65END 66 67 68test_abstract(<<END, "Foo", "the abstract", "more spaces"); 69=pod 70 71Foo - the abstract 72END 73 74test_abstract(<<END, "Catalyst::Plugin::Authentication", "Infrastructure plugin for the Catalyst authentication framework.", "contains a line break"); 75=pod 76 77=head1 NAME 78 79Catalyst::Plugin::Authentication - Infrastructure plugin for the Catalyst 80authentication framework. 81END 82