From: Dagfinn Ilmari Mannsåker Date: Sat, 13 Jun 2015 17:47:42 +0000 (+0100) Subject: Add author test for use strict/warnings X-Git-Tag: 0.07044~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8c2ca5eac1d4782c1d5be369c9bd0dcf680cb9d;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Add author test for use strict/warnings --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm b/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm index 49e8ad5..be9ef87 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm @@ -1,5 +1,6 @@ package DBIx::Class::Schema::Loader::DBI::Writing; use strict; +use warnings; our $VERSION = '0.07043'; diff --git a/t/01use.t b/t/01use.t index 0ea5875..8409c45 100644 --- a/t/01use.t +++ b/t/01use.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More tests => 10; BEGIN { diff --git a/t/10_01sqlite_common.t b/t/10_01sqlite_common.t index 233c079..a23c3f4 100644 --- a/t/10_01sqlite_common.t +++ b/t/10_01sqlite_common.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use lib qw(t/lib); use dbixcsl_common_tests; diff --git a/t/20invocations.t b/t/20invocations.t index f282d86..4b49f58 100644 --- a/t/20invocations.t +++ b/t/20invocations.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use Test::Warn; use DBIx::Class::Schema::Loader::Optional::Dependencies; diff --git a/t/21misc_fatal.t b/t/21misc_fatal.t index e1f9e2e..c50fc4f 100644 --- a/t/21misc_fatal.t +++ b/t/21misc_fatal.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use lib qw(t/lib); use make_dbictest_db; diff --git a/t/22dump.t b/t/22dump.t index 50a124c..7ead7a7 100644 --- a/t/22dump.t +++ b/t/22dump.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use Test::Exception; use Test::Warn; diff --git a/t/23dumpmore.t b/t/23dumpmore.t index 9490b2f..15b668e 100644 --- a/t/23dumpmore.t +++ b/t/23dumpmore.t @@ -15,7 +15,7 @@ $t->dump_test( classname => 'DBICTest::Schema::_no_skip_load_external', regexes => { Foo => [ - qr/package DBICTest::Schema::_no_skip_load_external::Foo;\nour \$skip_me = "bad mojo";\n1;/ + qr/package DBICTest::Schema::_no_skip_load_external::Foo;.*\nour \$skip_me = "bad mojo";\n1;/s ], }, ); @@ -28,7 +28,7 @@ $t->dump_test( }, neg_regexes => { Foo => [ - qr/package DBICTest::Schema::_skip_load_external::Foo;\nour \$skip_me = "bad mojo";\n1;/ + qr/package DBICTest::Schema::_skip_load_external::Foo;.*\nour \$skip_me = "bad mojo";\n1;/s ], }, ); diff --git a/t/26dump_use_moose.t b/t/26dump_use_moose.t index b03db06..cddf4cf 100644 --- a/t/26dump_use_moose.t +++ b/t/26dump_use_moose.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => 'use_moose'; use strict; +use warnings; use Test::More; diff --git a/t/27filter_generated.t b/t/27filter_generated.t index 20b45f2..efa3811 100644 --- a/t/27filter_generated.t +++ b/t/27filter_generated.t @@ -1,4 +1,5 @@ use strict; +use warnings; use DBIx::Class::Schema::Loader; use DBIx::Class::Schema::Loader::Utils 'slurp_file'; use File::Path; diff --git a/t/40overwrite_modifications.t b/t/40overwrite_modifications.t index 05130f9..1dd6c98 100644 --- a/t/40overwrite_modifications.t +++ b/t/40overwrite_modifications.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use Test::Exception; use Test::Warn; diff --git a/t/45relationships.t b/t/45relationships.t index e9e48d8..8bd8152 100644 --- a/t/45relationships.t +++ b/t/45relationships.t @@ -1,4 +1,5 @@ use strict; +use warnings; use Test::More; use Test::Exception; use Try::Tiny; diff --git a/t/50rt59849.t b/t/50rt59849.t index 9080ed7..346bc3c 100644 --- a/t/50rt59849.t +++ b/t/50rt59849.t @@ -2,6 +2,7 @@ # by Mark Hedges ( hedges -at| scriptdolphin.com ) use strict; +use warnings; use Test::More tests => 7 * 5; use Test::Exception; diff --git a/t/backcompat/0.04006/10sqlite_common.t b/t/backcompat/0.04006/10sqlite_common.t index c593b55..8b54dad 100644 --- a/t/backcompat/0.04006/10sqlite_common.t +++ b/t/backcompat/0.04006/10sqlite_common.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => 'test_backcompat'; use strict; +use warnings; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use dbixcsl_test_dir qw/$tdir/; diff --git a/t/backcompat/0.04006/11mysql_common.t b/t/backcompat/0.04006/11mysql_common.t index c77d1b4..484dd33 100644 --- a/t/backcompat/0.04006/11mysql_common.t +++ b/t/backcompat/0.04006/11mysql_common.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => qw(test_backcompat test_rdbms_mysql); use strict; +use warnings; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; diff --git a/t/backcompat/0.04006/12pg_common.t b/t/backcompat/0.04006/12pg_common.t index 070dcc1..4488506 100644 --- a/t/backcompat/0.04006/12pg_common.t +++ b/t/backcompat/0.04006/12pg_common.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => qw(test_backcompat test_rdbms_pg); use strict; +use warnings; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; diff --git a/t/backcompat/0.04006/13db2_common.t b/t/backcompat/0.04006/13db2_common.t index a886cb0..1c5a9c4 100644 --- a/t/backcompat/0.04006/13db2_common.t +++ b/t/backcompat/0.04006/13db2_common.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => qw(test_backcompat test_rdbms_db2); use strict; +use warnings; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; diff --git a/t/backcompat/0.04006/14ora_common.t b/t/backcompat/0.04006/14ora_common.t index edf1d9a..3b1920d 100644 --- a/t/backcompat/0.04006/14ora_common.t +++ b/t/backcompat/0.04006/14ora_common.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => qw(test_backcompat test_rdbms_oracle); use strict; +use warnings; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; diff --git a/t/backcompat/0.04006/20invocations.t b/t/backcompat/0.04006/20invocations.t index 1246c70..505a52c 100644 --- a/t/backcompat/0.04006/20invocations.t +++ b/t/backcompat/0.04006/20invocations.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => 'test_backcompat'; use strict; +use warnings; use Test::More; use lib qw(t/backcompat/0.04006/lib); use make_dbictest_db; diff --git a/t/backcompat/0.04006/21misc_fatal.t b/t/backcompat/0.04006/21misc_fatal.t index 849e3d4..c7a63c2 100644 --- a/t/backcompat/0.04006/21misc_fatal.t +++ b/t/backcompat/0.04006/21misc_fatal.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => 'test_backcompat'; use strict; +use warnings; use Test::More; use lib qw(t/backcompat/0.04006/lib); use make_dbictest_db; diff --git a/t/backcompat/0.04006/22dump.t b/t/backcompat/0.04006/22dump.t index 62c1a29..fa1a2da 100644 --- a/t/backcompat/0.04006/22dump.t +++ b/t/backcompat/0.04006/22dump.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => 'test_backcompat'; use strict; +use warnings; use Test::More; use lib qw(t/backcompat/0.04006/lib); use File::Path; diff --git a/t/backcompat/0.04006/23dumpmore.t b/t/backcompat/0.04006/23dumpmore.t index 8f87097..9959f73 100644 --- a/t/backcompat/0.04006/23dumpmore.t +++ b/t/backcompat/0.04006/23dumpmore.t @@ -2,6 +2,7 @@ use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => 'test_backcompat'; use strict; +use warnings; use Test::More; use lib qw(t/backcompat/0.04006/lib); use File::Path; diff --git a/t/backcompat/0.04006/lib/DBIXCSL_Test/Schema/LoaderTest1.pm b/t/backcompat/0.04006/lib/DBIXCSL_Test/Schema/LoaderTest1.pm index b4c3c65..959b277 100644 --- a/t/backcompat/0.04006/lib/DBIXCSL_Test/Schema/LoaderTest1.pm +++ b/t/backcompat/0.04006/lib/DBIXCSL_Test/Schema/LoaderTest1.pm @@ -1,4 +1,6 @@ package DBIXCSL_Test::Schema::LoaderTest1; +use strict; +use warnings; sub loader_test1_classmeth { 'all is well' } diff --git a/t/backcompat/0.04006/lib/DBIx/Class/TestComponent.pm b/t/backcompat/0.04006/lib/DBIx/Class/TestComponent.pm index 48677c7..cec95b8 100644 --- a/t/backcompat/0.04006/lib/DBIx/Class/TestComponent.pm +++ b/t/backcompat/0.04006/lib/DBIx/Class/TestComponent.pm @@ -1,4 +1,6 @@ package DBIx::Class::TestComponent; +use strict; +use warnings; sub dbix_class_testcomponent { 'dbix_class_testcomponent works' } diff --git a/t/backcompat/0.04006/lib/My/ResultBaseClass.pm b/t/backcompat/0.04006/lib/My/ResultBaseClass.pm index e246321..49a90c5 100644 --- a/t/backcompat/0.04006/lib/My/ResultBaseClass.pm +++ b/t/backcompat/0.04006/lib/My/ResultBaseClass.pm @@ -1,4 +1,6 @@ package My::ResultBaseClass; +use strict; +use warnings; use base 'DBIx::Class::Core'; diff --git a/t/backcompat/0.04006/lib/My/SchemaBaseClass.pm b/t/backcompat/0.04006/lib/My/SchemaBaseClass.pm index 7670d97..30690cb 100644 --- a/t/backcompat/0.04006/lib/My/SchemaBaseClass.pm +++ b/t/backcompat/0.04006/lib/My/SchemaBaseClass.pm @@ -1,4 +1,6 @@ package My::SchemaBaseClass; +use strict; +use warnings; use base 'DBIx::Class::Schema'; diff --git a/t/backcompat/0.04006/lib/TestAdditional.pm b/t/backcompat/0.04006/lib/TestAdditional.pm index d47fddb..d249a95 100644 --- a/t/backcompat/0.04006/lib/TestAdditional.pm +++ b/t/backcompat/0.04006/lib/TestAdditional.pm @@ -1,4 +1,6 @@ package TestAdditional; +use strict; +use warnings; sub test_additional { return "test_additional"; } diff --git a/t/backcompat/0.04006/lib/TestAdditionalBase.pm b/t/backcompat/0.04006/lib/TestAdditionalBase.pm index 85159c0..ca71569 100644 --- a/t/backcompat/0.04006/lib/TestAdditionalBase.pm +++ b/t/backcompat/0.04006/lib/TestAdditionalBase.pm @@ -1,4 +1,6 @@ package TestAdditionalBase; +use strict; +use warnings; sub test_additional_base { return "test_additional_base"; } sub test_additional_base_override { return "test_additional_base_override"; } diff --git a/t/backcompat/0.04006/lib/TestLeftBase.pm b/t/backcompat/0.04006/lib/TestLeftBase.pm index c836957..4ee2a13 100644 --- a/t/backcompat/0.04006/lib/TestLeftBase.pm +++ b/t/backcompat/0.04006/lib/TestLeftBase.pm @@ -1,4 +1,6 @@ package TestLeftBase; +use strict; +use warnings; sub test_additional_base_override { return "test_left_base_override"; } diff --git a/t/lib/DBICTest/Schema/_no_skip_load_external/Foo.pm b/t/lib/DBICTest/Schema/_no_skip_load_external/Foo.pm index 5fb0fa7..cf85fac 100644 --- a/t/lib/DBICTest/Schema/_no_skip_load_external/Foo.pm +++ b/t/lib/DBICTest/Schema/_no_skip_load_external/Foo.pm @@ -1,3 +1,6 @@ package DBICTest::Schema::_no_skip_load_external::Foo; +use strict; +use warnings; + our $skip_me = "bad mojo"; 1; diff --git a/t/lib/DBICTest/Schema/_skip_load_external/Foo.pm b/t/lib/DBICTest/Schema/_skip_load_external/Foo.pm index fbf8e44..9a80fda 100644 --- a/t/lib/DBICTest/Schema/_skip_load_external/Foo.pm +++ b/t/lib/DBICTest/Schema/_skip_load_external/Foo.pm @@ -1,3 +1,6 @@ package DBICTest::Schema::_skip_load_external::Foo; +use strict; +use warnings; + our $skip_me = "bad mojo"; 1; diff --git a/t/lib/DBIXCSL_Test/Schema/MyResult/LoaderTest1.pm b/t/lib/DBIXCSL_Test/Schema/MyResult/LoaderTest1.pm index f80a699..4b46e23 100644 --- a/t/lib/DBIXCSL_Test/Schema/MyResult/LoaderTest1.pm +++ b/t/lib/DBIXCSL_Test/Schema/MyResult/LoaderTest1.pm @@ -1,4 +1,6 @@ package DBIXCSL_Test::Schema::MyResult::LoaderTest1; +use strict; +use warnings; sub loader_test1_classmeth { 'all is well' } diff --git a/t/lib/DBIx/Class/TestComponent.pm b/t/lib/DBIx/Class/TestComponent.pm index 48677c7..cec95b8 100644 --- a/t/lib/DBIx/Class/TestComponent.pm +++ b/t/lib/DBIx/Class/TestComponent.pm @@ -1,4 +1,6 @@ package DBIx::Class::TestComponent; +use strict; +use warnings; sub dbix_class_testcomponent { 'dbix_class_testcomponent works' } diff --git a/t/lib/DBIx/Class/TestComponentForMap.pm b/t/lib/DBIx/Class/TestComponentForMap.pm index 882469e..7eaede8 100644 --- a/t/lib/DBIx/Class/TestComponentForMap.pm +++ b/t/lib/DBIx/Class/TestComponentForMap.pm @@ -1,4 +1,6 @@ package DBIx::Class::TestComponentForMap; +use strict; +use warnings; sub dbix_class_testcomponentmap { 'dbix_class_testcomponentmap works' } diff --git a/t/lib/My/ResultBaseClass.pm b/t/lib/My/ResultBaseClass.pm index c1b6b71..2f35d95 100644 --- a/t/lib/My/ResultBaseClass.pm +++ b/t/lib/My/ResultBaseClass.pm @@ -1,3 +1,6 @@ package My::ResultBaseClass; +use strict; +use warnings; + use base 'DBIx::Class::Core'; 1; diff --git a/t/lib/My/SchemaBaseClass.pm b/t/lib/My/SchemaBaseClass.pm index 4d65380..ad20974 100644 --- a/t/lib/My/SchemaBaseClass.pm +++ b/t/lib/My/SchemaBaseClass.pm @@ -1,3 +1,6 @@ package My::SchemaBaseClass; +use strict; +use warnings; + use base 'DBIx::Class::Schema'; 1; diff --git a/t/lib/TestAdditional.pm b/t/lib/TestAdditional.pm index d47fddb..d249a95 100644 --- a/t/lib/TestAdditional.pm +++ b/t/lib/TestAdditional.pm @@ -1,4 +1,6 @@ package TestAdditional; +use strict; +use warnings; sub test_additional { return "test_additional"; } diff --git a/t/lib/TestAdditionalBase.pm b/t/lib/TestAdditionalBase.pm index 85159c0..ca71569 100644 --- a/t/lib/TestAdditionalBase.pm +++ b/t/lib/TestAdditionalBase.pm @@ -1,4 +1,6 @@ package TestAdditionalBase; +use strict; +use warnings; sub test_additional_base { return "test_additional_base"; } sub test_additional_base_override { return "test_additional_base_override"; } diff --git a/t/lib/TestComponentFQN.pm b/t/lib/TestComponentFQN.pm index 772c7eb..415e31e 100644 --- a/t/lib/TestComponentFQN.pm +++ b/t/lib/TestComponentFQN.pm @@ -1,4 +1,6 @@ package TestComponentFQN; +use strict; +use warnings; sub testcomponent_fqn { 'TestComponentFQN works' } diff --git a/t/lib/TestComponentForMapFQN.pm b/t/lib/TestComponentForMapFQN.pm index a63f79a..80c1aec 100644 --- a/t/lib/TestComponentForMapFQN.pm +++ b/t/lib/TestComponentForMapFQN.pm @@ -1,4 +1,6 @@ package TestComponentForMapFQN; +use strict; +use warnings; sub testcomponentformap_fqn { 'TestComponentForMapFQN works' } diff --git a/t/lib/TestLeftBase.pm b/t/lib/TestLeftBase.pm index c836957..4ee2a13 100644 --- a/t/lib/TestLeftBase.pm +++ b/t/lib/TestLeftBase.pm @@ -1,4 +1,6 @@ package TestLeftBase; +use strict; +use warnings; sub test_additional_base_override { return "test_left_base_override"; } diff --git a/t/lib/TestSchemaBaseClass.pm b/t/lib/TestSchemaBaseClass.pm index b83172b..c03e97e 100644 --- a/t/lib/TestSchemaBaseClass.pm +++ b/t/lib/TestSchemaBaseClass.pm @@ -1,5 +1,8 @@ package TestSchemaBaseClass; -use base DBIx::Class::Schema; +use strict; +use warnings; + +use base 'DBIx::Class::Schema'; our $test_ok = 0; diff --git a/t/lib/TestSchemaComponentFQN.pm b/t/lib/TestSchemaComponentFQN.pm index 1b4c6c2..4b30d7f 100644 --- a/t/lib/TestSchemaComponentFQN.pm +++ b/t/lib/TestSchemaComponentFQN.pm @@ -1,4 +1,6 @@ package TestSchemaComponentFQN; +use strict; +use warnings; sub testschemacomponent_fqn { 'TestSchemaComponentFQN works' } diff --git a/t/lib/dbixcsl_dumper_tests.pm b/t/lib/dbixcsl_dumper_tests.pm index 0382c0c..8e5a2da 100644 --- a/t/lib/dbixcsl_dumper_tests.pm +++ b/t/lib/dbixcsl_dumper_tests.pm @@ -1,6 +1,7 @@ package dbixcsl_dumper_tests; use strict; +use warnings; use Test::More; use File::Path; use IPC::Open3; diff --git a/xt/strictures.t b/xt/strictures.t new file mode 100644 index 0000000..51207d4 --- /dev/null +++ b/xt/strictures.t @@ -0,0 +1,41 @@ +use DBIx::Class::Schema::Loader::Optional::Dependencies + -skip_all_without => 'test_strictures'; + +use warnings; +use strict; + +use Test::More; +use File::Find; +use lib 't/lib'; + +# The rationale is - if we can load all our optdeps +# that are related to lib/ - then we should be able to run +# perl -c checks (via syntax_ok), and all should just work +my $missing_groupdeps_present = grep + { DBIx::Class::Schema::Loader::Optional::Dependencies->req_ok_for($_) } + grep + { $_ !~ /^ (?: test | rdbms | dist ) _ /x } + keys %{DBIx::Class::Schema::Loader::Optional::Dependencies->req_group_list} +; + +find({ + wanted => sub { + -f $_ or return; + m/\.(?: pm | pl | t )$ /ix or return; + + return if m{^(?: + lib/DBIx/Class/Schema/Loader/Optional/Dependencies.pm # no stictures by design (load speed sensitive) + )$}x; + + my $f = $_; + + Test::Strict::strict_ok($f); + Test::Strict::warnings_ok($f); + + Test::Strict::syntax_ok($f) + if ! $missing_groupdeps_present and $f =~ /^ (?: lib )/x; + }, + no_chdir => 1, +}, (qw(lib t script maint)) ); + +done_testing;