@@ -0,0 +1,11 @@
+branches:
+ except:
+ - gh-pages
+language: perl
+perl:
+ - "5.20"
+ - "5.18"
+ - "5.16"
+ - "5.14"
+ - "5.12"
+ - "5.10"
@@ -1,5 +1,16 @@
Test::Strict - Check syntax, presence of use strict; and test coverage
+0.25 2014-10-16T07:52:00Z
+ - Link to GitHub bugtracker - is it working now?
+ - Some tests refactored.
+
+0.25 2014-10-15T19:52:00Z
+ - Update Makefile.PL to point to GitHub as bug tracking system
+ - use 5.012; enables use strict; #7
+
+0.24 2014-10-05T08:28:00Z
+ - add Catmandu::Sane, Moo::Role, MooseX::Role::Parameterized, Role::Tiny
+ to the list of modules implying strict and warnings. #6
0.23 2014-03-06T10:39:05Z
- Standardize dates in the Changes file.
@@ -1,3 +1,4 @@
+.travis.yml
Changes
lib/Test/Strict.pm
Makefile.PL
@@ -1,10 +1,10 @@
{
- "abstract" : "unknown",
+ "abstract" : "Check syntax, presence of use strict; and test coverage",
"author" : [
"Pierre Denis <pdenis@cpan.org>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.132830",
+ "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060",
"license" : [
"perl_5"
],
@@ -21,13 +21,11 @@
},
"prereqs" : {
"build" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "0"
- }
+ "requires" : {}
},
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : "0"
+ "ExtUtils::MakeMaker" : "6.64"
}
},
"runtime" : {
@@ -37,21 +35,29 @@
"File::Spec" : "0.01",
"File::Temp" : "0.01",
"FindBin" : "0.01",
- "Test::Builder" : "0.01",
- "Test::Simple" : "0.47"
+ "Test::Builder" : "0.01"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "File::Temp" : "0.01",
+ "Test::More" : "1.00"
}
}
},
"release_status" : "stable",
"resources" : {
- "license" : [
- "http://dev.perl.org/licenses/"
- ],
+ "bugtracker" : {
+ "web" : "http://github.com/szabgab/Test-Strict"
+ },
"repository" : {
- "url" : "https://github.com/szabgab/Test-Strict"
+ "type" : "git",
+ "url" : "http://github.com/szabgab/Test-Strict.git",
+ "web" : "http://github.com/szabgab/Test-Strict",
+ "x_license" : "http://dev.perl.org/licenses/"
}
},
- "version" : "0.23",
+ "version" : "0.26",
"x_contributors" : [
"Gabor Szabo <szabgab@cpan.org>",
"Peter Vereshagin <veresc@cpan.org>",
@@ -1,34 +1,34 @@
---
-abstract: unknown
+abstract: 'Check syntax, presence of use strict; and test coverage'
author:
- 'Pierre Denis <pdenis@cpan.org>'
build_requires:
- ExtUtils::MakeMaker: 0
+ File::Temp: '0.01'
+ Test::More: '1.00'
configure_requires:
- ExtUtils::MakeMaker: 0
+ ExtUtils::MakeMaker: '6.64'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.132830'
+generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Test-Strict
no_index:
directory:
- t
- inc
requires:
- Devel::Cover: 0.43
- File::Find: 0.01
- File::Spec: 0.01
- File::Temp: 0.01
- FindBin: 0.01
- Test::Builder: 0.01
- Test::Simple: 0.47
+ Devel::Cover: '0.43'
+ File::Find: '0.01'
+ File::Spec: '0.01'
+ File::Temp: '0.01'
+ FindBin: '0.01'
+ Test::Builder: '0.01'
resources:
- license: http://dev.perl.org/licenses/
- repository: https://github.com/szabgab/Test-Strict
-version: 0.23
+ bugtracker: http://github.com/szabgab/Test-Strict
+ repository: http://github.com/szabgab/Test-Strict.git
+version: '0.26'
x_contributors:
- 'Gabor Szabo <szabgab@cpan.org>'
- 'Peter Vereshagin <veresc@cpan.org>'
@@ -1,28 +1,76 @@
-use ExtUtils::MakeMaker;
use strict;
-WriteMakefile(
- NAME => "Test::Strict",
- VERSION_FROM => 'lib/Test/Strict.pm',
- PREREQ_PM => {
- 'Test::Simple' => 0.47,
- 'Test::Builder' => 0.01,
- 'File::Spec' => 0.01,
- 'FindBin' => 0.01,
- 'File::Find' => 0.01,
- 'Devel::Cover' => 0.43,
- 'File::Temp' => 0.01,
- },
- LICENSE => 'perl',
- AUTHOR => 'Pierre Denis <pdenis@cpan.org>',
- META_MERGE => {
- resources => {
- repository => 'https://github.com/szabgab/Test-Strict',
- license => 'http://dev.perl.org/licenses/',
- },
- x_contributors => [
- 'Gabor Szabo <szabgab@cpan.org>',
- 'Peter Vereshagin <veresc@cpan.org>',
- 'Graham Knop <haarg@cpan.org>',
- ],
+use warnings;
+
+use ExtUtils::MakeMaker;
+my %conf = (
+ NAME => "Test::Strict",
+ AUTHOR => 'Pierre Denis <pdenis@cpan.org>',
+ VERSION_FROM => 'lib/Test/Strict.pm',
+ ABSTRACT_FROM => 'lib/Test/Strict.pm',
+ PREREQ_PM => {
+ 'Test::Builder' => 0.01,
+ 'File::Spec' => 0.01,
+ 'FindBin' => 0.01,
+ 'File::Find' => 0.01,
+ 'Devel::Cover' => 0.43,
+ 'File::Temp' => 0.01,
},
);
+
+if (eval { ExtUtils::MakeMaker->VERSION(6.3002) }) {
+ $conf{LICENSE} = 'perl';
+}
+
+if (eval { ExtUtils::MakeMaker->VERSION(6.46) }) {
+ $conf{META_MERGE} = {
+ 'meta-spec' => { version => 2 },
+ resources => {
+ repository => {
+ type => 'git',
+ url => 'http://github.com/szabgab/Test-Strict.git',
+ web => 'http://github.com/szabgab/Test-Strict',
+ license => 'http://dev.perl.org/licenses/',
+ },
+ bugtracker => {
+ web => 'http://github.com/szabgab/Test-Strict',
+ },
+ },
+ x_contributors => [
+ 'Gabor Szabo <szabgab@cpan.org>',
+ 'Peter Vereshagin <veresc@cpan.org>',
+ 'Graham Knop <haarg@cpan.org>',
+ ],
+ };
+}
+
+my %configure_requires = (
+ 'ExtUtils::MakeMaker' => '6.64',
+);
+my %build_requires = ();
+my %test_requires = (
+ 'Test::More' => '1.00',
+
+ 'File::Temp' => '0.01',
+);
+
+### merging data "standard code"
+if (eval { ExtUtils::MakeMaker->VERSION(6.52) }) {
+ $conf{CONFIGURE_REQUIRES} = \%configure_requires;
+} else {
+ %{ $conf{PREREQ_PM} } = (%{ $conf{PREREQ_PM} }, %configure_requires);
+}
+
+if (eval { ExtUtils::MakeMaker->VERSION(6.5503) }) {
+ $conf{BUILD_REQUIRES} = \%build_requires;
+} else {
+ %{ $conf{PREREQ_PM} } = (%{ $conf{PREREQ_PM} }, %build_requires);
+}
+if (eval { ExtUtils::MakeMaker->VERSION(6.64) }) {
+ $conf{TEST_REQUIRES} = \%test_requires;
+} else {
+ %{ $conf{PREREQ_PM} } = (%{ $conf{PREREQ_PM} }, %test_requires);
+}
+
+
+WriteMakefile(%conf);
+
@@ -67,19 +67,19 @@ use FindBin qw($Bin);
use File::Find;
use Config;
-use vars qw( $VERSION $PERL $COVERAGE_THRESHOLD $COVER $UNTAINT_PATTERN $PERL_PATTERN $CAN_USE_WARNINGS $TEST_SYNTAX $TEST_STRICT $TEST_WARNINGS $TEST_SKIP $DEVEL_COVER_OPTIONS $DEVEL_COVER_DB @MODULES_ENABLING_STRICT @MODULES_ENABLING_WARNINGS );
-$VERSION = '0.23';
-$PERL = $^X || 'perl';
-$COVERAGE_THRESHOLD = 50; # 50%
-$UNTAINT_PATTERN = qr|^(.*)$|;
-$PERL_PATTERN = qr/^#!.*perl/;
-$CAN_USE_WARNINGS = ($] >= 5.006);
-$TEST_SYNTAX = 1; # Check compile
-$TEST_STRICT = 1; # Check use strict;
-$TEST_WARNINGS = 0; # Check use warnings;
-$TEST_SKIP = []; # List of files to skip check
-$DEVEL_COVER_OPTIONS = '+ignore,".Test.Strict\b"';
-$DEVEL_COVER_DB = 'cover_db';
+our $COVER;
+our $VERSION = '0.26';
+our $PERL = $^X || 'perl';
+our $COVERAGE_THRESHOLD = 50; # 50%
+our $UNTAINT_PATTERN = qr|^(.*)$|;
+our $PERL_PATTERN = qr/^#!.*perl/;
+our $CAN_USE_WARNINGS = ($] >= 5.006);
+our $TEST_SYNTAX = 1; # Check compile
+our $TEST_STRICT = 1; # Check use strict;
+our $TEST_WARNINGS = 0; # Check use warnings;
+our $TEST_SKIP = []; # List of files to skip check
+our $DEVEL_COVER_OPTIONS = '+ignore,".Test.Strict\b"';
+our $DEVEL_COVER_DB = 'cover_db';
my $IS_WINDOWS = $^O =~ /MSwin/i;
my $Test = Test::Builder->new;
@@ -228,6 +228,9 @@ sub _strict_ok {
return 1;
}
}
+ if (/\buse\s+(5.01\d+)/ and $1 >= 5.012) {
+ return 1;
+ }
}
return;
}
@@ -237,13 +240,14 @@ sub _strict_ok {
Experimental. Returning a list of modules and pragmata that enable strict.
To modify this list, change C<@Test::Strict::MODULES_ENABLING_STRICT>.
-List taken from https://metacpan.org/source/DAXIM/Module-CPANTS-Analyse-0.86/lib/Module/CPANTS/Kwalitee/Uses.pm
+List taken from https://metacpan.org/pod/Module::CPANTS::Kwalitee::Uses v95
=cut
-@MODULES_ENABLING_STRICT = qw(
+our @MODULES_ENABLING_STRICT = qw(
strict
Any::Moose
+ Catmandu::Sane
Class::Spiffy
Coat
common::sense
@@ -252,10 +256,12 @@ List taken from https://metacpan.org/source/DAXIM/Module-CPANTS-Analyse-0.86/lib
Modern::Perl
Mojo::Base
Moo
+ Moo::Role
Moose
Moose::Exporter
Moose::Role
MooseX::Declare
+ MooseX::Role::Parameterized
MooseX::Types
Mouse
Mouse::Role
@@ -263,6 +269,7 @@ List taken from https://metacpan.org/source/DAXIM/Module-CPANTS-Analyse-0.86/lib
perl5i::1
perl5i::2
perl5i::latest
+ Role::Tiny
Spiffy
strictures
);
@@ -274,13 +281,14 @@ sub modules_enabling_strict { return @MODULES_ENABLING_STRICT }
Experimental. Returning a list of modules and pragmata that enable warnings
To modify this list, change C<@Test::Strict::MODULES_ENABLING_WARNINGS>.
-List taken from https://metacpan.org/source/DAXIM/Module-CPANTS-Analyse-0.86/lib/Module/CPANTS/Kwalitee/Uses.pm
+List taken from https://metacpan.org/pod/Module::CPANTS::Kwalitee::Uses v95
=cut
-@MODULES_ENABLING_WARNINGS = qw(
+our @MODULES_ENABLING_WARNINGS = qw(
warnings
Any::Moose
+ Catmandu::Sane
Class::Spiffy
Coat
common::sense
@@ -289,10 +297,12 @@ List taken from https://metacpan.org/source/DAXIM/Module-CPANTS-Analyse-0.86/lib
Modern::Perl
Mojo::Base
Moo
+ Moo::Role
Moose
Moose::Exporter
Moose::Role
MooseX::Declare
+ MooseX::Role::Parameterized
MooseX::Types
Mouse
Mouse::Role
@@ -300,6 +310,7 @@ List taken from https://metacpan.org/source/DAXIM/Module-CPANTS-Analyse-0.86/lib
perl5i::1
perl5i::2
perl5i::latest
+ Role::Tiny
Spiffy
strictures
);
@@ -36,47 +36,49 @@ syntax_ok( 'Test::Strict' );
strict_ok( 'Test::Strict' );
warnings_ok( $0 );
-diag 'Start creating files';
-my $modern_perl_file1 = make_modern_perl_file1();
-diag $modern_perl_file1;
+my $tmpdir = tempdir( CLEANUP => 1 );
+diag "Start creating files in $tmpdir";
+my $modern_perl_file1 = make_file("$tmpdir/abc.pL", 'modern_perl_file1');
+#diag $modern_perl_file1;
warnings_ok( $modern_perl_file1, 'warn modern_perl1' );
strict_ok( $modern_perl_file1, 'strict modern_perl1' );
# let's make sure that a file that is not recognized as "Perl file"
# still lets the syntax_ok test work
-my $extensionless_file = make_extensionless_perl_file1();
-diag $extensionless_file;
+my $extensionless_file = make_file("$tmpdir/extensionless", 'extensionless');
+#diag $extensionless_file;
ok ! Test::Strict::_is_perl_module($extensionless_file), "_is_perl_module $extensionless_file";
ok ! Test::Strict::_is_perl_script($extensionless_file), "_is_perl_script $extensionless_file";
warnings_ok( $extensionless_file, 'warn extensionless_file' );
strict_ok( $extensionless_file, 'strict extensionless_file' );
syntax_ok( $extensionless_file, 'syntax extensionless_file' );
-my $warning_file1 = make_warning_file1();
-diag "File1: $warning_file1";
+my $warning_file1 = make_file("$tmpdir/warning1.pL", 'warning1');
+#diag "File1: $warning_file1";
warnings_ok( $warning_file1, 'file1' );
-my $warning_file2 = make_warning_file2();
-diag "File2: $warning_file2";
+my $warning_file2 = make_file("$tmpdir/warning2.pL", 'warning2');
+#diag "File2: $warning_file2";
warnings_ok( $warning_file2, 'file2' );
# TODO: does warnings::register turn on warnings?
-#my $warning_file3 = make_warning_file3();
-#diag "File3: $warning_file3";
+#my $warning_file3 = make_file("$tmpdir/warning3.pm", 'warning3');
#warnings_ok( $warning_file3, 'file3' );
-my $warning_file4 = make_warning_file4();
-diag "File4: $warning_file4";
+my $warning_file4 = make_file("$tmpdir/warning4.pm", 'warning4');
+#diag "File4: $warning_file4";
warnings_ok( $warning_file4, 'file4' );
-my $warning_file5 = make_warning_file5();
-diag "File5: $warning_file5";
+my $warning_file5 = make_file("$tmpdir/warning5.pm", 'warning5');
+#diag "File5: $warning_file5";
warnings_ok( $warning_file5, 'file5' );
-{
- my $warning_file6 = make_warning_file6();
- diag "File6: $warning_file6";
+subtest custom => sub {
+ plan tests => 2;
+
+ my $warning_file6 = make_file("$tmpdir/warning6.pm", 'warning6');
+ #diag "File6: $warning_file6";
local @Test::Strict::MODULES_ENABLING_WARNINGS
= (@Test::Strict::MODULES_ENABLING_WARNINGS, 'Custom');
@@ -86,7 +88,7 @@ warnings_ok( $warning_file5, 'file5' );
warnings_ok( $warning_file6, 'file6' );
strict_ok( $warning_file6, 'file6' );
-}
+};
{
my ($warnings_files_dir, $files, $file_to_skip) = make_warning_files();
@@ -98,102 +100,43 @@ warnings_ok( $warning_file5, 'file5' );
all_perl_files_ok( $warnings_files_dir );
}
-exit;
-
-sub make_modern_perl_file1 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' );
- print $fh <<'DUMMY';
-#!/usr/bin/perl
-use Modern::Perl;
-
-print "hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
-sub make_extensionless_perl_file1 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '' );
- print $fh <<'DUMMY';
-use strict;
-use warnings;
-
-print "hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
-
-
-sub make_warning_file1 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' );
- print $fh <<'DUMMY';
-#!/usr/bin/perl -w
-
-print "hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
-
-sub make_warning_file2 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pL' );
- print $fh <<'DUMMY';
- use warnings FATAL => 'all' ;
-print "Hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
-
-sub make_warning_file3 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pm' );
- print $fh <<'DUMMY';
- use strict;
- use warnings::register ;
-print "Hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
-
-sub make_warning_file4 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pm' );
- print $fh <<'DUMMY';
-use Mouse ;
-print "Hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
+subtest perl5_12 => sub {
+ plan tests => 1;
+ my $filename = make_file("$tmpdir/perl5_12.pl", 'perl5_12');
+ strict_ok($filename);
+};
-sub make_warning_file5 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pm' );
- print $fh <<'DUMMY';
-use Moose;
-print "Hello world";
+exit;
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
+{
+ my %data;
+ sub make_file {
+ my ($filename, $name) = @_;
+ if (not %data) {
+ my $section_name;
+ while (my $row = <DATA>) {
+ if (not $section_name) {
+ $section_name = $row;
+ chomp $section_name;
+ next;
+ }
+ if ($row =~ /^---------/) {
+ undef $section_name;
+ next;
+ }
+ die 'Undefined section_name - internal test error' if not defined $section_name;
+ $data{$section_name} .= $row;
+ }
+ }
+ open my $fh, '>', $filename or die "Could not open '$filename' for writing. $!";
+ print $fh $data{$name};
+ close $fh;
+ return $filename;
+ }
+ #return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
}
-sub make_warning_file6 {
- my $tmpdir = tempdir( CLEANUP => 1 );
- my ($fh, $filename) = tempfile( DIR => $tmpdir, SUFFIX => '.pm' );
- print $fh <<'DUMMY';
-use Custom;
-print "Hello world";
-
-DUMMY
- return $HAS_WIN32 ? Win32::GetLongPathName($filename) : $filename;
-}
sub make_warning_files {
my $tmpdir = tempdir( CLEANUP => 1 );
@@ -238,3 +181,56 @@ DUMMY
return ($tmpdir, \@files, $filename3);
}
+
+__END__
+modern_perl_file1
+#!/usr/bin/perl
+use Modern::Perl;
+
+print "hello world";
+---------
+extensionless
+use strict;
+use warnings;
+
+print "hello world";
+
+---------
+warning1
+#!/usr/bin/perl -w
+
+print "hello world";
+
+---------
+warning2
+ use warnings FATAL => 'all' ;
+print "Hello world";
+
+---------
+warning3
+ use strict;
+ use warnings::register ;
+print "Hello world";
+
+---------
+warning4
+use Mouse ;
+print "Hello world";
+
+---------
+warning5
+use Moose;
+print "Hello world";
+
+---------
+warning6
+use Custom;
+print "Hello world";
+
+---------
+perl5_12
+use 5.012;
+
+$x = 23;
+---------
+