From d57a2aad6f3f555186e2fae01b070b051faa6f79 Mon Sep 17 00:00:00 2001 From: Sehong Na Date: Sat, 31 May 2014 12:57:49 +0900 Subject: [PATCH 1/1] Initialize Tizen 2.3 --- Build.PL | 26 ++++ Changes | 184 +++++++++++++++++++++++++ MANIFEST | 26 ++++ META.yml | 30 ++++ README | 32 +++++ lib/Test/Pod.pm | 299 ++++++++++++++++++++++++++++++++++++++++ packaging/perl-Test-Pod.changes | 62 +++++++++ packaging/perl-Test-Pod.spec | 54 ++++++++ t/00-load.t | 13 ++ t/all_pod_files.t | 35 +++++ t/cut-outside-block.pod | 13 ++ t/cut-outside-block.t | 21 +++ t/empty-file.pod | 0 t/good.t | 24 ++++ t/item-ordering.pod | 45 ++++++ t/item-ordering.t | 19 +++ t/load.t | 7 + t/missing-file.t | 29 ++++ t/pod.t | 5 + t/pod/good-pod-script | 19 +++ t/pod/good-pod-script.bat | 35 +++++ t/pod/good.pod | 17 +++ t/pod/no_pod.pod | 7 + t/selftest.t | 12 ++ t/spaced-directives.pod | 20 +++ t/spaced-directives.t | 22 +++ t/unknown-directive.pod | 25 ++++ t/unknown-directive.t | 21 +++ 28 files changed, 1102 insertions(+) create mode 100644 Build.PL create mode 100644 Changes create mode 100644 MANIFEST create mode 100644 META.yml create mode 100644 README create mode 100644 lib/Test/Pod.pm create mode 100644 packaging/perl-Test-Pod.changes create mode 100644 packaging/perl-Test-Pod.spec create mode 100644 t/00-load.t create mode 100644 t/all_pod_files.t create mode 100644 t/cut-outside-block.pod create mode 100644 t/cut-outside-block.t create mode 100644 t/empty-file.pod create mode 100644 t/good.t create mode 100644 t/item-ordering.pod create mode 100644 t/item-ordering.t create mode 100644 t/load.t create mode 100644 t/missing-file.t create mode 100644 t/pod.t create mode 100644 t/pod/good-pod-script create mode 100644 t/pod/good-pod-script.bat create mode 100644 t/pod/good.pod create mode 100644 t/pod/no_pod.pod create mode 100644 t/selftest.t create mode 100644 t/spaced-directives.pod create mode 100644 t/spaced-directives.t create mode 100644 t/unknown-directive.pod create mode 100644 t/unknown-directive.t diff --git a/Build.PL b/Build.PL new file mode 100644 index 0000000..6790430 --- /dev/null +++ b/Build.PL @@ -0,0 +1,26 @@ +use strict; +use warnings; +use Module::Build '0.30'; + +Module::Build->new( + module_name => 'Test::Pod', + license => 'perl', + configure_requires => { 'Module::Build' => '0.30', }, + build_requires => { + 'Module::Build' => '0.30', + 'Test::More' => '0.70', + }, + requires => { + 'Pod::Simple' => '3.07', + 'Test::More' => '0.70',, + 'Test::Builder::Tester' => '1.02', + 'File::Spec' => 0, + }, + meta_merge => { + resources => { + homepage => 'http://search.cpan.org/dist/Test-Pod/', + bugtracker => 'http://github.com/theory/test-pod/issues/', + repository => 'http://github.com/theory/test-pod/tree/', + } + }, +)->create_build_script; diff --git a/Changes b/Changes new file mode 100644 index 0000000..c40de1f --- /dev/null +++ b/Changes @@ -0,0 +1,184 @@ +Change log for Test::Pod + +1.42 - 2010-03-10T19:41:20 + * Fixed invalid Pod link. Thanks to Markus Sonderegger. + * Changed license in the POD to "Same as Perl" to match the license listed in + `META.yml`. + * Changed `Build.PL` to require Module::Build 0.30. It already does in + `configure_requires`, but also doing so on the `use` line helps provide + a more useful error message in older toolchain tools that don't use + `configure_requires`. + * Updated `MANIFEST` so that the `README` is actually included in the + distribution. + * Now recognizes `.bat` files as Perl files when they contain + "--*-Perl-*--" on the first line. Thanks to Olivier 'dolmen' Mengué for + the patch (RT #46973). + * `all_pod_files_ok()` now operates on directories as well as files. + Thanks to Adriano Ferreira for the patch (RT #33025). + * Files with no POD now have " (no pod)" added to test name. Thanks to + Adriano Ferreira for the patch (RT #34955). + * Updated documentation to note that `.PL` files are considered Perl + files. Thanks to Adriano Ferreira for the spot (RT #34955). + * `all_pod_files_ok()` now lets `pod_file_ok()` set the default test name, + rather than doing so itself. Thanks to Adriano Ferreira for the spot (RT + #34955). + +1.41 - 2010-01-14T20:09:25 + * Maintenance transfered to David Wheeler. + * Test::Pod no longer complains about the construct L, as it is + no longer illegal (as of Perl 5.11.3). + * Switched to Module::Build. + +1.40 - Sun Jul 12 23:32:11 CDT 2009 + [THINGS THAT MAY BREAK YOUR CODE] + Test::Pod now requires Perl 5.8.0. + + [ENHANCEMENTS] + Test::Pod now complains about the illegal construct L. + Thanks to Paul Miller. + + The list of directories to exclude is now much longer, and is + available in %Test::Pod::ignore_dirs. This list is right now: + + '.bzr' => 'Bazaar', + '.git' => 'Git', + '.hg' => 'Mercurial', + '.pc' => 'quilt', + '.svn' => 'Subversion', + CVS => 'CVS', + RCS => 'RCS', + SCCS => 'SCCS', + _darcs => 'darcs', + _sgbak => 'Vault/Fortress', + + +1.26 - Wed Jul 19 09:54:48 CDT 2006 + + No new functionality in this version. + + [FIXES] + * Fixed a Win32 build bug. + * Fixed a bug in the SYNOPSIS. + +1.24 - Wed Feb 1 15:18:06 PST 2006 + [THINGS THAT MAY BREAK YOUR CODE] + * The long-deprecated pod_ok() is now gone, along with all its + constants. + + [ENHANCEMENTS] + * Now runs properly under VMS. Thanks to Peter Edwards. + +1.22 - Sun Oct 23 23:45:51 CDT 2005 + [ENHANCEMENTS] + * Added check for lines with only whitespace before or after a + directive. Older POD formatters can get confused by such + lines since they goof up paragraph mode. (RT #6467) + + [FIXES] + * Bumped up requirements to Test::Simple 0.62. + +1.20 - Wed Jun 23 00:28:35 CDT 2004 + [ENHANCEMENTS] + * Looks in blib/ if there is one, otherwise looks in lib/ + * Thanks to David Wheeler for nudging. + +1.18 - Fri May 28 23:48:28 CDT 2004 + [FIXES] + * Now exports all_pod_files() as advertised. + * Also includes *.t files as Pod. + +1.16 - Fri Apr 30 17:42:50 CDT 2004 + [FIXES] + * Fixed a warning under 5.8.3. Also explicitly closes dir handles + when searching for POD. + +1.14 - Wed Apr 28 23:38:29 CDT 2004 + [ENHANCEMENTS] + * Now runs taint-safe. No longer uses File::Find. I'm trying to + get all my modules to run under -T correctly, so this is big. + +1.12 - Sat Mar 13 10:34:06 CST 2004 + [ENHANCEMENTS] + * all_pod_files() now picks up *.PL files. + +1.10 - Tue Mar 9 23:27:16 CST 2004 + [ENHANCEMENTS] + * Almost all of my coverage is almost to 100%. + + [FIXES] + * Fixed some test bugs on Win32. + * Message problems if the file is missing. + +1.08 - Wed Jan 21 00:40:07 CST 2004 + No new features or fixes. + + [FIXES] + * t/all_pod_files.t failed because in my zeal to be a good + cross-platform guy, I used File::Spec separators on lists to + compare against those coming from File::Find, which uses slashes. + +1.06 - Sat Jan 10 08:47:55 CST 2004 + No new features or fixes. + + [FIXES] + * t/all_pod_files.t failed because all_pod_files() returns an + unsorted list. Fixed. + +1.04 - Fri Jan 9 22:39:15 CST 2004 + [ENHANCEMENTS] + * all_pod_files() can now take multiple start directories. + Thanks to David Wheeler for the patch. + +1.03 + [FIXES] + * All the *ok() functions now return the value of the underlying ok(). + + [DOCUMENTATION] + * All functions are now documented. + + [INTERNALS] + * Removed valid_file, which was not being used. + + +1.02 - Mon Nov 10 09:07:39 CST 2003 + No new functionality. If 1.00 installed for you, then you don't + need 1.02. + + [FIXES] + * Fixed dumb test failure in t/all_pod_files.t. + + [DOCUMENTATION] + * Spiffed up the SYNOPSIS. + + +1.00 - Mon Nov 10 00:06:30 CST 2003 + [NEW FEATURES] + * Added all_pod_files_ok() method. + +0.96 - Sat Oct 11 22:46:00 CST 2003 + * Removed dependency on IO::Scalar, which was wrong. + * Requires newest, most-lenient Pod::Simple. + * Added various tests to the t/ hierarchy. Thanks to David Wheeler + for help on this. + +0.95 - Mon Mar 3 09:35:00 CST 2002 + * Rewrote to use Pod::Simple instead of Pod::Checker + * Deprecated the pod_ok function. + * Added pod_file_ok() to replace pod_ok(). + +0.90 - Tue Dec 3 18:59:39 CST 2002 + * things seem to be going well, so this is not in beta :) + * cleanup up some formatting + * fixed the bad pod test which some Pod::Checker versions reported + extra errors + +0.72 - Thu Nov 14 20:16:13 CST 2002 + * cleaned up Makefile.PL and tests + * no code changes + +0.71 - Mon Sep 9 10:58:22 CDT 2002 + * added Test::Builder::Tester to PREREQ_PM + +0.70 - Thu Sep 5 22:39:13 CDT 2002 + * pod_ok shows POD errors and warnings if it fails + * you can give the test a name diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..36eb8c1 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,26 @@ +Build.PL +Changes +lib/Test/Pod.pm +MANIFEST This list of files +META.yml +README +t/00-load.t +t/all_pod_files.t +t/cut-outside-block.pod +t/cut-outside-block.t +t/empty-file.pod +t/good.t +t/item-ordering.pod +t/item-ordering.t +t/load.t +t/missing-file.t +t/pod.t +t/pod/good-pod-script +t/pod/good-pod-script.bat +t/pod/good.pod +t/pod/no_pod.pod +t/selftest.t +t/spaced-directives.pod +t/spaced-directives.t +t/unknown-directive.pod +t/unknown-directive.t diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..2f9c7e8 --- /dev/null +++ b/META.yml @@ -0,0 +1,30 @@ +--- +abstract: 'check for POD errors in files' +author: + - 'Currently maintained by David E. Wheeler, C<< >>.' +build_requires: + Module::Build: 0.30 + Test::More: 0.70 +configure_requires: + Module::Build: 0.30 +generated_by: 'Module::Build version 0.3601' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Test-Pod +provides: + Test::Pod: + file: lib/Test/Pod.pm + version: 1.42 +requires: + File::Spec: 0 + Pod::Simple: 3.07 + Test::Builder::Tester: 1.02 + Test::More: 0.70 +resources: + bugtracker: http://github.com/theory/test-pod/issues/ + homepage: http://search.cpan.org/dist/Test-Pod/ + license: http://dev.perl.org/licenses/ + repository: http://github.com/theory/test-pod/tree/ +version: 1.42 diff --git a/README b/README new file mode 100644 index 0000000..a505608 --- /dev/null +++ b/README @@ -0,0 +1,32 @@ +Test/Pod version 1.42 +===================== + +This library's module, Test::Pod, provides an interface for validating POD in +module files. + +INSTALLATION + +To install this module, type the following: + + perl Build.PL + ./Build + ./Build test + ./Build install + +Dependencies +------------ + +Test::Pod requires the following modules: + +* Pod::Simple 3.07 +* Test::More 0.70 +* Test::Builder::Tester 1.02 +* File::Spec + +Copyright and Licence +--------------------- + +Copyright 2006-2010, Andy Lester. Some Rights Reserved. + +You may use, modify, and distribute this package under the terms as the +Artistic License v2.0 or GNU Public License v2.0. diff --git a/lib/Test/Pod.pm b/lib/Test/Pod.pm new file mode 100644 index 0000000..b4e6644 --- /dev/null +++ b/lib/Test/Pod.pm @@ -0,0 +1,299 @@ +package Test::Pod; + +use strict; + +=head1 NAME + +Test::Pod - check for POD errors in files + +=head1 VERSION + +Version 1.42 + +=cut + +our $VERSION = '1.42'; + +=head1 SYNOPSIS + +C lets you check the validity of a POD file, and report +its results in standard C fashion. + + use Test::Pod tests => $num_tests; + pod_file_ok( $file, "Valid POD file" ); + +Module authors can include the following in a F file and +have C automatically find and check all POD files in a +module distribution: + + use Test::More; + eval "use Test::Pod 1.00"; + plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; + all_pod_files_ok(); + +You can also specify a list of files to check, using the +C function supplied: + + use strict; + use Test::More; + eval "use Test::Pod 1.00"; + plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; + my @poddirs = qw( blib script ); + all_pod_files_ok( all_pod_files( @poddirs ) ); + +Or even (if you're running under L): + + use strict; + use Test::More; + eval "use Test::Pod 1.00"; + plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; + + my @poddirs = qw( blib script ); + use File::Spec::Functions qw( catdir updir ); + all_pod_files_ok( + all_pod_files( map { catdir updir, $_ } @poddirs ) + ); + +=head1 DESCRIPTION + +Check POD files for errors or warnings in a test file, using +C to do the heavy lifting. + +=cut + +use 5.008; + +use Test::Builder; +use File::Spec; +use Pod::Simple; + +our %ignore_dirs = ( + '.bzr' => 'Bazaar', + '.git' => 'Git', + '.hg' => 'Mercurial', + '.pc' => 'quilt', + '.svn' => 'Subversion', + CVS => 'CVS', + RCS => 'RCS', + SCCS => 'SCCS', + _darcs => 'darcs', + _sgbak => 'Vault/Fortress', +); + +my $Test = Test::Builder->new; + +sub import { + my $self = shift; + my $caller = caller; + + for my $func ( qw( pod_file_ok all_pod_files all_pod_files_ok ) ) { + no strict 'refs'; + *{$caller."::".$func} = \&$func; + } + + $Test->exported_to($caller); + $Test->plan(@_); +} + +sub _additional_test_pod_specific_checks { + my ($ok, $errata, $file) = @_; + + return $ok; +} + +=head1 FUNCTIONS + +=head2 pod_file_ok( FILENAME[, TESTNAME ] ) + +C will okay the test if the POD parses correctly. Certain +conditions are not reported yet, such as a file with no pod in it at all. + +When it fails, C will show any pod checking errors as +diagnostics. + +The optional second argument TESTNAME is the name of the test. If it +is omitted, C chooses a default test name "POD test +for FILENAME". + +=cut + +sub pod_file_ok { + my $file = shift; + my $name = @_ ? shift : "POD test for $file"; + + if ( !-f $file ) { + $Test->ok( 0, $name ); + $Test->diag( "$file does not exist" ); + return; + } + + my $checker = Pod::Simple->new; + + $checker->output_string( \my $trash ); # Ignore any output + $checker->parse_file( $file ); + + my $ok = !$checker->any_errata_seen; + $ok = _additional_test_pod_specific_checks( $ok, ($checker->{errata}||={}), $file ); + + $name .= ' (no pod)' if !$checker->content_seen; + $Test->ok( $ok, $name ); + if ( !$ok ) { + my $lines = $checker->{errata}; + for my $line ( sort { $a<=>$b } keys %$lines ) { + my $errors = $lines->{$line}; + $Test->diag( "$file ($line): $_" ) for @$errors; + } + } + + return $ok; +} # pod_file_ok + +=head2 all_pod_files_ok( [@entries] ) + +Checks all the files under C<@entries> for valid POD. It runs +L on directories and assumes everything else to be a file to +be tested. It calls the C function for you (one test for each file), +so you can't have already called C. + +If C<@entries> is empty or not passed, the function finds all POD files in +files in the F directory if it exists, or the F directory if not. A +POD file is one that ends with F<.pod>, F<.pl> and F<.pm>, or any file where +the first line looks like a shebang line. + +If you're testing a module, just make a F: + + use Test::More; + eval "use Test::Pod 1.00"; + plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; + all_pod_files_ok(); + +Returns true if all pod files are ok, or false if any fail. + +=cut + +sub all_pod_files_ok { + my @args = @_ ? @_ : _starting_points(); + my @files = map { -d $_ ? all_pod_files($_) : $_ } @args; + + $Test->plan( tests => scalar @files ); + + my $ok = 1; + foreach my $file ( @files ) { + pod_file_ok( $file ) or undef $ok; + } + return $ok; +} + +=head2 all_pod_files( [@dirs] ) + +Returns a list of all the Perl files in I<@dirs> and in directories below. If +no directories are passed, it defaults to F if F exists, or else +F if not. Skips any files in CVS, .svn, .git and similar directories. See +C<%Test::Pod::ignore_dirs> for a list of them. + +A Perl file is: + +=over 4 + +=item * Any file that ends in F<.PL>, F<.pl>, F<.PL>, F<.pm>, F<.pod>, or F<.t>. + +=item * Any file that has a first line with a shebang and "perl" on it. + +=item * Any file that ends in F<.bat> and has a first line with "--*-Perl-*--" on it. + +=back + +The order of the files returned is machine-dependent. If you want them +sorted, you'll have to sort them yourself. + +=cut + +sub all_pod_files { + my @queue = @_ ? @_ : _starting_points(); + my @pod = (); + + while ( @queue ) { + my $file = shift @queue; + if ( -d $file ) { + local *DH; + opendir DH, $file or next; + my @newfiles = readdir DH; + closedir DH; + + @newfiles = File::Spec->no_upwards( @newfiles ); + @newfiles = grep { not exists $ignore_dirs{ $_ } } @newfiles; + + foreach my $newfile (@newfiles) { + my $filename = File::Spec->catfile( $file, $newfile ); + if ( -f $filename ) { + push @queue, $filename; + } + else { + push @queue, File::Spec->catdir( $file, $newfile ); + } + } + } + if ( -f $file ) { + push @pod, $file if _is_perl( $file ); + } + } # while + return @pod; +} + +sub _starting_points { + return 'blib' if -e 'blib'; + return 'lib'; +} + +sub _is_perl { + my $file = shift; + + return 1 if $file =~ /\.PL$/; + return 1 if $file =~ /\.p(?:l|m|od)$/; + return 1 if $file =~ /\.t$/; + + open my $fh, '<', $file or return; + my $first = <$fh>; + close $fh; + + return 1 if defined $first && ($first =~ /(?:^#!.*perl)|--\*-Perl-\*--/); + + return; +} + +=head1 TODO + +STUFF TO DO + +Note the changes that are being made. + +Note that you no longer can test for "no pod". + +=head1 AUTHOR + +Currently maintained by David E. Wheeler, C<< >>. + +Originally by brian d foy. + +Maintainer emeritus: Andy Lester, C<< >>. + +=head1 ACKNOWLEDGEMENTS + +Thanks to +Andy Lester, +David Wheeler, +Paul Miller +and +Peter Edwards +for contributions and to C for the original code. + +=head1 COPYRIGHT AND LICENSE + +Copyright 2006-2010, Andy Lester. Some Rights Reserved. + +This module is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. + +=cut + +1; diff --git a/packaging/perl-Test-Pod.changes b/packaging/perl-Test-Pod.changes new file mode 100644 index 0000000..c44ae82 --- /dev/null +++ b/packaging/perl-Test-Pod.changes @@ -0,0 +1,62 @@ +* Wed Jul 28 2010 Quanxian Wang - 1.42 +- update to 1.42 + +* Tue Jul 20 2010 Quanxian Wang - 1.40 +- Change the version dependency + +* Wed June 30 2010 Quanxian Wang - 1.40 +- Add %doc before man file entry + +* Thu Dec 24 2009 Passion Zhao - 1.40 +- Update to 1.40 + +* Wed Feb 27 2008 Tom "spot" Callaway - 1.26-4 +- Rebuild for perl 5.10 (again) + +* Thu Jan 10 2008 Tom "spot" Callaway - 1.26-3 +- rebuild for new perl + +* Thu Dec 20 2007 Tom "spot" Callaway - 1.26-2 +- license tag fix + +* Fri Jul 21 2006 Jose Pedro Oliveira - 1.26-1 +- Update to 1.26. + +* Fri Feb 17 2006 Jose Pedro Oliveira - 1.24-2 +- Rebuild for FC5 (perl 5.8.8). + +* Fri Feb 3 2006 Jose Pedro Oliveira - 1.24-1 +- Update to 1.24. + +* Thu Dec 29 2005 Jose Pedro Oliveira - 1.22-1 +- Update to 1.22. + +* Thu May 12 2005 Jose Pedro Oliveira - 1.20-3 +- Add dist tag. + +* Fri Apr 7 2005 Michael Schwendt - 1.20-2 +- rebuilt + +* Thu Jun 24 2004 Jose Pedro Oliveira - 0:1.20-0.fdr.1 +- Update to 1.20. + +* Wed May 12 2004 Jose Pedro Oliveira - 0:1.16-0.fdr.2 +- Avoid creation of the perllocal.pod file (make pure_install). + +* Mon May 3 2004 Ville Skyttä - 0:1.16-0.fdr.1 +- Update to 1.16, dir handling patch applied upstream. + +* Fri Apr 30 2004 Ville Skyttä - 0:1.14-0.fdr.1 +- Update to 1.14. +- Require perl(:MODULE_COMPAT_*). +- Add patch to avoid warnings from all_pod_files(). + +* Sun Mar 14 2004 Ville Skyttä - 0:1.12-0.fdr.1 +- Update to 1.12. + +* Thu Jan 22 2004 Ville Skyttä - 0:1.08-0.fdr.1 +- Update to 1.08. +- Use %%{perl_vendorlib}. + +* Wed Nov 5 2003 Ville Skyttä - 0:0.96-0.fdr.1 +- First build. diff --git a/packaging/perl-Test-Pod.spec b/packaging/perl-Test-Pod.spec new file mode 100644 index 0000000..9230119 --- /dev/null +++ b/packaging/perl-Test-Pod.spec @@ -0,0 +1,54 @@ +#specfile originally created for Fedora, modified for Moblin Linux +Name: perl-Test-Pod +Version: 1.42 +Release: 1 +Summary: Perl module for checking for POD errors in files + +Group: Development/Libraries +License: GPL+ or Artistic +URL: http://search.cpan.org/dist/Test-Pod/ +Source0: http://www.cpan.org/authors/id/P/PE/PETDANCE/Test-Pod-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch +BuildRequires: perl(Module::Build) >= 0.30 +BuildRequires: perl(Pod::Simple) >= 3.07 +BuildRequires: perl(Test::Builder::Tester) >= 1.02 +BuildRequires: perl(Test::More) >= 0.70 +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%description +%{summary}. + + +%prep +%setup -q -n Test-Pod-%{version} + + +%build +%{__perl} Build.PL --installdirs vendor +./Build + + +%install +rm -rf $RPM_BUILD_ROOT +./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 +find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';' +find $RPM_BUILD_ROOT -type d -depth -exec rmdir {} 2>/dev/null ';' +chmod -R u+w $RPM_BUILD_ROOT/* + + +%check +LC_ALL=C ./Build test + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%{perl_vendorlib}/Test/* +%doc %{_mandir}/man3/*.3pm* + + diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..ec082e0 --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,13 @@ +#!perl -T + +use warnings; +use strict; +use Test::More tests => 2; + +BEGIN { + use_ok( 'Test::Pod' ); + use_ok( 'Pod::Simple' ); +} + +diag( "Testing Test::Pod $Test::Pod::VERSION, Perl $], $^X" ); +diag( "Using Pod::Simple $Pod::Simple::VERSION" ); diff --git a/t/all_pod_files.t b/t/all_pod_files.t new file mode 100644 index 0000000..74c8f2e --- /dev/null +++ b/t/all_pod_files.t @@ -0,0 +1,35 @@ +#!perl -Tw + +use strict; + +use Test::More tests => 2; + +BEGIN { + use_ok( "Test::Pod" ); +} + +my @expected; +if ( $^O eq "VMS" ) { + @expected = ( + File::Spec->catfile( 'blib', 'lib', 'Test', 'Pod.pm' ), + File::Spec->catfile( 't', 'pod', 'good-pod-script.' ), + File::Spec->catfile( 't', 'pod', 'good-pod-script.bat' ), + File::Spec->catfile( 't', 'pod', 'good.pod' ), + File::Spec->catfile( 't', 'pod', 'no_pod.pod' ), + ); +} +else { + # The expected files have slashes, not File::Spec separators, because + # that's how File::Find does it. + @expected = qw( + blib/lib/Test/Pod.pm + t/pod/good-pod-script + t/pod/good-pod-script.bat + t/pod/good.pod + t/pod/no_pod.pod + ); +} +my @files = sort map { lc } all_pod_files( "blib", "t/pod" ); +@expected = sort map { lc } @expected; +s{\\}{/}g for @files, @expected; +is_deeply( \@files, \@expected, "Got all the distro files" ); diff --git a/t/cut-outside-block.pod b/t/cut-outside-block.pod new file mode 100644 index 0000000..ce2da67 --- /dev/null +++ b/t/cut-outside-block.pod @@ -0,0 +1,13 @@ +# $Id: cut-outside-block.pod 48 2003-03-04 17:16:27Z petdance $ + +use strict; + +=cut + +=head1 COPYRIGHT + +Copyright 2002, Andy Lester + +=cut + +use warnings; diff --git a/t/cut-outside-block.t b/t/cut-outside-block.t new file mode 100644 index 0000000..2c8e64b --- /dev/null +++ b/t/cut-outside-block.t @@ -0,0 +1,21 @@ +#!perl -T + +use strict; + +use Test::Builder::Tester tests => 2; +use Test::More; + +BEGIN { + use_ok( 'Test::Pod' ); +} + +BAD: { + my $file = 't/cut-outside-block.pod'; + test_out( "not ok 1 - POD test for $file" ); + pod_file_ok( $file ); + test_fail(-1); + test_diag( + "$file (5): =cut found outside a pod block. Skipping to next block." + ); + test_test( "$file is bad" ); +} diff --git a/t/empty-file.pod b/t/empty-file.pod new file mode 100644 index 0000000..e69de29 diff --git a/t/good.t b/t/good.t new file mode 100644 index 0000000..60e32bd --- /dev/null +++ b/t/good.t @@ -0,0 +1,24 @@ +#!perl -T + +use strict; + +use Test::Builder::Tester tests => 3; +use Test::More; + +BEGIN { + use_ok( 'Test::Pod' ); +} + + +my $filename = "t/pod/good.pod"; +GOOD: { + test_out( "ok 1 - Blargo!" ); + pod_file_ok( $filename, "Blargo!" ); + test_test( 'Handles good.pod OK' ); +} + +DEFAULT_NAME: { + test_out( "ok 1 - POD test for t/pod/good.pod" ); + pod_file_ok( $filename ); + test_test( 'Handles good.pod OK, and builds default name OK' ); +} diff --git a/t/item-ordering.pod b/t/item-ordering.pod new file mode 100644 index 0000000..8a6e3d4 --- /dev/null +++ b/t/item-ordering.pod @@ -0,0 +1,45 @@ +# $Id: item-ordering.pod 53 2003-03-04 17:41:18Z petdance $ + +=head1 COPYRIGHT + +Copyright 2002, Andy Lester + +=cut + +# Here's a list with items out of order + +=over 4 + +=item 2 + +This is the first prime number + +=item 3 + +This is the second prime number + +=item 5 + +This is the third prime number + +=back + +=cut + + +# Here's a list with items that can't be + +=over 4 + +Blah blah blah + +=item 1 + +Item One + +=item 2 + +Item 2 + +=cut + diff --git a/t/item-ordering.t b/t/item-ordering.t new file mode 100644 index 0000000..d851ac6 --- /dev/null +++ b/t/item-ordering.t @@ -0,0 +1,19 @@ +#!perl -T + +use strict; + +use Test::Builder::Tester tests => 2; +use Test::More; + +BEGIN { + use_ok( 'Test::Pod' ); +} + +my $file = 't/item-ordering.pod'; +test_out( "not ok 1 - POD test for $file" ); +pod_file_ok( $file ); +test_fail(-1); +test_diag( + "$file (32): You can't have =items (as at line 36) unless the first thing after the =over is an =item", +); +test_test( "$file is bad" ); diff --git a/t/load.t b/t/load.t new file mode 100644 index 0000000..b344162 --- /dev/null +++ b/t/load.t @@ -0,0 +1,7 @@ +#!perl -T + +use Test::More tests=>1; + +BEGIN { + use_ok( 'Test::Pod' ); +} diff --git a/t/missing-file.t b/t/missing-file.t new file mode 100644 index 0000000..ded0dca --- /dev/null +++ b/t/missing-file.t @@ -0,0 +1,29 @@ +#!perl -T + +use strict; + +use Test::Builder::Tester tests => 3; +use Test::More; + +BEGIN { + use_ok( 'Test::Pod' ); +} + +MISSING_FILE: { + my $file = 't/non-existent.pod'; + test_out( "not ok 1 - I hope the file is there" ); + test_fail(+1); + pod_file_ok( $file, "I hope the file is there" ); + test_diag( "$file does not exist" ); + test_test( "$file is bad" ); +} + + +MISSING_FILE_NO_MESSAGE: { + my $file = 't/non-existent.pod'; + test_out( "not ok 1 - POD test for $file" ); + test_fail(+1); + pod_file_ok( $file ); + test_diag( "$file does not exist" ); + test_test( "$file is bad" ); +} diff --git a/t/pod.t b/t/pod.t new file mode 100644 index 0000000..df0c600 --- /dev/null +++ b/t/pod.t @@ -0,0 +1,5 @@ +#!perl -Tw +use Test::More; +eval "use Test::Pod 1.00"; +plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; +all_pod_files_ok(); diff --git a/t/pod/good-pod-script b/t/pod/good-pod-script new file mode 100644 index 0000000..101a8c0 --- /dev/null +++ b/t/pod/good-pod-script @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +=head1 NAME + +This is a pretend script that we need to check + +=head1 DESCRIPTION + +This is a pod file without errors. + +=head1 AUTHOR + +Andy Lester, garbage-address@aol.com + +=head1 COPYRIGHT + +Copyright 2004, Andy Lester + +=cut diff --git a/t/pod/good-pod-script.bat b/t/pod/good-pod-script.bat new file mode 100644 index 0000000..4e54db1 --- /dev/null +++ b/t/pod/good-pod-script.bat @@ -0,0 +1,35 @@ +@rem = '--*-Perl-*-- +@echo off +if "%OS%" == "Windows_NT" goto WinNT +perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto endofperl +:WinNT +perl -x -S %0 %* +if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl +if %errorlevel% == 9009 echo You do not have Perl in your PATH. +if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul +goto endofperl +@rem '; +#!/usr/bin/perl +#line 15 + +=head1 NAME + +This is a pretend script that we need to check + +=head1 DESCRIPTION + +This is a pod file without errors. + +=head1 AUTHOR + +Andy Lester, garbage-address@aol.com + +=head1 COPYRIGHT + +Copyright 2004, Andy Lester + +=cut + +__END__ +:endofperl diff --git a/t/pod/good.pod b/t/pod/good.pod new file mode 100644 index 0000000..03c28f5 --- /dev/null +++ b/t/pod/good.pod @@ -0,0 +1,17 @@ +=head1 NAME + +Test::Pod test pod -- a valid pod file + +=head1 DESCRIPTION + +This is a pod file without errors. + +=head1 AUTHOR + +Andy Lester, garbage-address@aol.com + +=head1 COPYRIGHT + +Copyright 2004, Andy Lester + +=cut diff --git a/t/pod/no_pod.pod b/t/pod/no_pod.pod new file mode 100644 index 0000000..b82fab0 --- /dev/null +++ b/t/pod/no_pod.pod @@ -0,0 +1,7 @@ +Test::Pod test pod -- a valid pod file + +This is a pod file without pod commands + +Andy Lester, garbage-address@aol.com + +Copyright 2004, Andy Lester diff --git a/t/selftest.t b/t/selftest.t new file mode 100644 index 0000000..1792d2e --- /dev/null +++ b/t/selftest.t @@ -0,0 +1,12 @@ +#!perl -T + +use Test::More tests=>2; + +BEGIN { + use_ok( "Test::Pod" ); +} + +my $self = $INC{'Test/Pod.pm'}; + +pod_file_ok($self, "My own pod is OK"); + diff --git a/t/spaced-directives.pod b/t/spaced-directives.pod new file mode 100644 index 0000000..1d397b0 --- /dev/null +++ b/t/spaced-directives.pod @@ -0,0 +1,20 @@ +=head1 NAME + +Test::Pod test pod -- a valid pod file + +=head1 DESCRIPTION + +This is a pod file where there are invisible +spaces on either side of directives. One row +of spaces is just before the AUTHOR directive, +and one is right after the COPYRIGHT. + +=head1 AUTHOR + +Andy Lester, garbage-address@aol.com + +=head1 COPYRIGHT + +Copyright 2004, Andy Lester + +=cut diff --git a/t/spaced-directives.t b/t/spaced-directives.t new file mode 100644 index 0000000..064577f --- /dev/null +++ b/t/spaced-directives.t @@ -0,0 +1,22 @@ +#!perl -T + +use strict; + +use Test::More skip_all => "Not written yet"; +use Test::Builder::Tester tests => 2; +use Test::More; + +BEGIN { + use_ok( 'Test::Pod' ); +} + +BAD: { + my $name = 'Test name: Something not likely to accidentally occur!'; + my $file = 't/spaced-directives.pod'; + test_out( "not ok 1 - $name" ); + pod_file_ok( $file, $name ); + test_fail(-1); + test_diag('*** WARNING: line containing nothing but whitespace in paragraph at line 11 in file t/spaced-directives.pod'); + test_diag('*** WARNING: line containing nothing but whitespace in paragraph at line 17 in file t/spaced-directives.pod'); + test_test( "$name is bad" ); +} diff --git a/t/unknown-directive.pod b/t/unknown-directive.pod new file mode 100644 index 0000000..9e35507 --- /dev/null +++ b/t/unknown-directive.pod @@ -0,0 +1,25 @@ +# $Id: unknown-directive.pod 91 2004-01-26 03:50:06Z petdance $ + +=head1 NAME + +Test::Pod test pod -- a valid pod file + +=head1 DESCRIPTION + +=over4 + +This is a pod file with an incorrect =over. + +=under 4 + +This is a pod file with a bad directive. + +=head1 AUTHOR + +brian d foy, Ebdfoy@cpan.orgE + +=head1 COPYRIGHT + +Copyright 2002, brian d foy + +=cut diff --git a/t/unknown-directive.t b/t/unknown-directive.t new file mode 100644 index 0000000..025fcaa --- /dev/null +++ b/t/unknown-directive.t @@ -0,0 +1,21 @@ +#!perl -T + +use strict; + +use Test::Builder::Tester tests => 2; +use Test::More; + +BEGIN { + use_ok( 'Test::Pod' ); +} + +BAD: { + my $name = 'Test name: Something not likely to accidentally occur!'; + my $file = 't/unknown-directive.pod'; + test_out( "not ok 1 - $name" ); + pod_file_ok( $file, $name ); + test_fail(-1); + test_diag( "$file (9): Unknown directive: =over4",); + test_diag( "$file (13): Unknown directive: =under",); + test_test( "$name is bad" ); +} -- 2.7.4