Subject: [PATCH 2/5] Test for example code of modules passing a syntax and use strict check

From: Raphael Geissert <[email-masked]>
Date: Fri, 1 May 2009 23:48:54 -0500

Test::Synopsis is required, but the test is skipped if not available.
---
 lib/Lintian/Check.pm          |    2 +-
 lib/Lintian/Collect.pm        |    2 +-
 lib/Lintian/Collect/Binary.pm |    2 +-
 lib/Lintian/Collect/Source.pm |    2 +-
 lib/Lintian/Data.pm           |    1 +
 lib/Lintian/Output.pm         |    2 +-
 lib/Lintian/Tag/Info.pm       |    2 +-
 t/scripts/pod-synopsis.t      |   10 ++++++++++
 8 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 t/scripts/pod-synopsis.t

diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index 9bd5809..7f8447d 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -37,7 +37,7 @@ Lintian::Check -- Lintian checks shared between multiple scripts
 
     use Lintian::Check qw(check_maintainer);
 
-    check_maintainer ($maintainer, $field);
+    check_maintainer my ($maintainer, $field);
 
 =head1 DESCRIPTION
 
diff --git a/lib/Lintian/Collect.pm b/lib/Lintian/Collect.pm
index 00b5159..953d5a3 100644
--- a/lib/Lintian/Collect.pm
+++ b/lib/Lintian/Collect.pm
@@ -76,7 +76,7 @@ Lintian::Collect - Lintian interface to package data collection
 
 =head1 SYNOPSIS
 
-    my $collect = Lintian::Collect->new($name, $type);
+    my $collect = Lintian::Collect->new(my $name, my $type);
     $name = $collect->name;
     $type = $collect->type;
 
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index a44fdef..2e1ec38 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -296,7 +296,7 @@ Lintian::Collect::Binary - Lintian interface to binary package data collection
 
 =head1 SYNOPSIS
 
-    my $collect = Lintian::Collect->new($name, $type);
+    my $collect = Lintian::Collect->new(my $name, my $type);
     if ($collect->native) {
         print "Package is native\n";
     }
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index 959245b..e34789f 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -227,7 +227,7 @@ Lintian::Collect::Source - Lintian interface to source package data collection
 
 =head1 SYNOPSIS
 
-    my $collect = Lintian::Collect->new($name, $type);
+    my $collect = Lintian::Collect->new(my $name, my $type);
     if ($collect->native) {
         print "Package is native\n";
     }
diff --git a/lib/Lintian/Data.pm b/lib/Lintian/Data.pm
index e529069..5556bf6 100644
--- a/lib/Lintian/Data.pm
+++ b/lib/Lintian/Data.pm
@@ -82,6 +82,7 @@ Lintian::Data - Lintian interface to query lists of keywords
 
 =head1 SYNOPSIS
 
+    my $keyword;
     my $list = Lintian::Data->new('type');
     if ($list->known($keyword)) {
         # do something ...
diff --git a/lib/Lintian/Output.pm b/lib/Lintian/Output.pm
index 7123e49..bb0ed82 100644
--- a/lib/Lintian/Output.pm
+++ b/lib/Lintian/Output.pm
@@ -44,7 +44,7 @@ Lintian::Output - Lintian messaging handling
 =head1 SYNOPSIS
 
     # non-OO
-    use Lintian::Output qw(:messages)
+    use Lintian::Output qw(:messages);
 
     $Lintian::Output::GLOBAL->verbose(1);
 
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index f4f198e..176aa9e 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -49,7 +49,7 @@ Lintian::Tag::Info - Lintian interface to tag metadata
 
 =head1 SYNOPSIS
 
-    my $tag = Lintian::Tag::Info->new('some-tag');
+    my $tag_info = Lintian::Tag::Info->new('some-tag');
     print "Tag info is:\n";
     print $tag_info->description('text', '   ');
     print "\nTag info in HTML is:\n";
diff --git a/t/scripts/pod-synopsis.t b/t/scripts/pod-synopsis.t
new file mode 100644
index 0000000..4dc32ef
--- /dev/null
+++ b/t/scripts/pod-synopsis.t
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+
+use Test::More;
+use Test::Pod;
+eval "use Test::Synopsis";
+plan skip_all => "Test::Synopsis required for testing" if $@;
+
+my @pod_files = all_pod_files("$ENV{'LINTIAN_ROOT'}/lib");
+plan tests => scalar(@pod_files);
+synopsis_ok(@pod_files);