Login
Get generation of t/NamingConventions/Capitalization.run in place.
authorElliot Shank <perl@galumph.com>
Mon, 27 Oct 2008 00:37:16 +0000 (00:37 +0000)
committerElliot Shank <perl@galumph.com>
Mon, 27 Oct 2008 00:37:16 +0000 (00:37 +0000)
What it generates right now is static, but all the infrastructure is
in place.

.gitignore
Build.PL
MANIFEST.SKIP
Makefile.PL
inc/Perl/Critic/BuildUtilities.pm
t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run.PL
t/NamingConventions/Capitalization.run.PL [moved from t/NamingConventions/Capitalization.run with 57% similarity]

index 43ef193..d3ae336 100644 (file)
@@ -11,6 +11,7 @@ cover_db
 lib/Perl/Critic/PolicySummary.pod
 t/*_without_optional_dependencies.t
 t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
+t/NamingConventions/Capitalization.run
 t/Variables/RequireLocalizedPunctuationVars.run
 xt/author/generated/t/*_without_optional_dependencies.t
 xt/author/generated/xt/author/*_without_optional_dependencies.t
index 0ec10ff..3381a16 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -150,7 +150,6 @@ my $builder = $class->new(
     add_to_cleanup => [
         qw<
             Debian_CPANTS.txt
-            lib/Perl/Critic/PolicySummary.pod
             Makefile
             Makefile.old
             MANIFEST
@@ -158,9 +157,8 @@ my $builder = $class->new(
             META.yml
             pm_to_blib
             README
-            t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
-            t/Variables/RequireLocalizedPunctuationVars.run
         >,
+        values %{ get_PL_files() },
         test_wrappers_to_generate(),
     ],
 );
index 0fcad1c..5b71fda 100644 (file)
@@ -5,6 +5,7 @@
 ^lib/Perl/Critic/PolicySummary.pod$
 _without_optional_dependencies.t$
 ^t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run$
+^t/NamingConventions/Capitalization.run$
 ^t/Variables/RequireLocalizedPunctuationVars.run$
 
 ## Below here are generic entries that apply to any project ##
index 9954957..af11e14 100644 (file)
@@ -85,10 +85,8 @@ WriteMakefile(
         FILES =>
             join
                 q< >,
-                'lib/Perl/Critic/PolicySummary.pod',
+                values %{ get_PL_files() },
                 test_wrappers_to_generate(),
-                't/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run',
-                't/Variables/RequireLocalizedPunctuationVars.run',
     },
 );
 
index 0be7fe7..9793a30 100644 (file)
@@ -87,6 +87,7 @@ sub test_wrappers_to_generate {
 my @TARGET_FILES = qw<
     lib/Perl/Critic/PolicySummary.pod
     t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
+    t/NamingConventions/Capitalization.run
     t/Variables/RequireLocalizedPunctuationVars.run
 >;
 
index 88751eb..b249b8d 100644 (file)
@@ -4,11 +4,11 @@ use 5.006001;
 use strict;
 use warnings;
 
-use English qw{-no_match_vars};
+use English qw< -no_match_vars >;
 use Carp qw< confess >;
 
-use Carp qw{ confess };
-use Fatal qw{ open close };
+use Carp qw< confess >;
+use Fatal qw< open close >;
 
 our $VERSION = '1.093_01';
 
similarity index 57%
rename from t/NamingConventions/Capitalization.run
rename to t/NamingConventions/Capitalization.run.PL
index 7fcf9a4..c492b72 100644 (file)
@@ -1,3 +1,53 @@
+#!/usr/bin/env perl
+
+use 5.006001;
+use strict;
+use warnings;
+
+use English qw< -no_match_vars >;
+use Carp qw< confess >;
+
+use Carp qw<  confess >;
+use Fatal qw<  open close >;
+
+our $VERSION = '1.093_01';
+
+
+
+my $this_program = __FILE__;
+(my $test_file_name = $this_program) =~ s/ [.] PL \z //xms;
+if ($this_program eq $test_file_name) {
+    confess
+        'Was not able to figure out the name of the file to generate.'
+        . "This program: $this_program.";
+}
+
+print "\n\nGenerating $test_file_name.\n";
+
+
+
+open my $test_file, '>', $test_file_name    ## no critic (RequireBriefOpen)
+    or confess "Could not open $test_file_name: $ERRNO";
+
+
+print {$test_file} <<"END_HEADER";
+# Do not edit!!!  This test suite generated by $this_program.
+END_HEADER
+
+emit_simple_tests($test_file);
+emit_footer($test_file);
+
+close $test_file;
+print "Done.\n\n";
+
+#-----------------------------------------------------------------------------
+
+sub emit_simple_tests {
+    my ($test_file) = @_;
+
+    print {$test_file} <<'END_SIMPLE_TESTS';
+#-----------------------------------------------------------------------------
+
 ## name Basic Passes
 ## failures 0
 ## cut
@@ -14,13 +64,6 @@ my  $foo123bar;
 sub foo123 {}
 sub foo123bar {}
 
-my $fooBar;   # camelCase is ok
-my $fooBAR;
-sub fooBar {}
-sub fooBAR {}
-
-my  $CONSTANT;
-
 package This::SomeThing;
 package This;
 package This::Thing;
@@ -105,7 +148,29 @@ Readonly::Scalar my $Foo = 23;
 Readonly::Scalar my $foo = 23;
 Readonly::Scalar my $fooBAR = 23;
 my $CONSTANT = 23;
+END_SIMPLE_TESTS
+
+    return;
+}
+
+
+sub emit_footer {
+
+    print {$test_file} <<'END_FOOTER';
+
+#-----------------------------------------------------------------------------
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 78
+#   indent-tabs-mode: nil
+#   c-indentation-style: bsd
+# End:
+# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
+END_FOOTER
 
+    return;
+}
 
 #-----------------------------------------------------------------------------
 # Local Variables: