From: Peter Rabbitson Date: Mon, 18 Mar 2013 07:31:32 +0000 (+0100) Subject: Get rid of subtests so we can test threads X-Git-Tag: v0.10010~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ed6069878c2506fed25cf5dd71c4fa6e276b80da;p=p5sagit%2FClass-Accessor-Grouped.git Get rid of subtests so we can test threads --- diff --git a/Makefile.PL b/Makefile.PL index 64a9109..d6b1a26 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -28,7 +28,7 @@ if (can_xs or $Module::Install::AUTHOR) { if $] > '5.008'; # CXSA does not work on 5.6 } -test_requires 'Test::More' => '0.94'; +test_requires 'Test::More' => '0.88'; test_requires 'Test::Exception' => '0.31'; clean_files "Class-Accessor-Grouped-* t/var"; diff --git a/t/accessors.t b/t/accessors.t index 9a27723..e2ea1f7 100644 --- a/t/accessors.t +++ b/t/accessors.t @@ -1,6 +1,7 @@ use Test::More; use strict; use warnings; +no warnings 'once'; use lib 't/lib'; use B qw/svref_2object/; @@ -134,4 +135,4 @@ for my $class (qw( } } -done_testing; +done_testing unless $::SUBTESTING; diff --git a/t/accessors_pp.t b/t/accessors_pp.t index 67f1331..5a28b2f 100644 --- a/t/accessors_pp.t +++ b/t/accessors_pp.t @@ -20,10 +20,14 @@ BEGIN { require Class::Accessor::Grouped; } + # rerun the regular 3 tests under the assumption of no Sub::Name -for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t clean_namespace.t/) { +our $SUBTESTING = 1; +for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t/) { + + for (1,2) { + note "\nTesting $tname without Sub::Name (pass $_)\n\n"; - subtest "$tname without Sub::Name (pass $_)" => sub { my $tfn = catfile($Bin, $tname); delete $INC{$_} for ( @@ -35,7 +39,7 @@ for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t clean_namespace.t/) do($tfn); - } for (1 .. 2); + } } done_testing; diff --git a/t/accessors_ro.t b/t/accessors_ro.t index f9427b1..708e70c 100644 --- a/t/accessors_ro.t +++ b/t/accessors_ro.t @@ -1,7 +1,8 @@ -use Test::More tests => 58; +use Test::More; use Test::Exception; use strict; use warnings; +no warnings 'once'; use Config; use lib 't/lib'; @@ -108,5 +109,4 @@ for my $name (sort keys %$test_accessors) { is($obj->$alias, 'a'); }; -#important -1; +done_testing unless $::SUBTESTING; diff --git a/t/accessors_wo.t b/t/accessors_wo.t index ee16358..9fc2bcd 100644 --- a/t/accessors_wo.t +++ b/t/accessors_wo.t @@ -1,7 +1,8 @@ -use Test::More tests => 46; +use Test::More; use Test::Exception; use strict; use warnings; +no warnings 'once'; use Config; use lib 't/lib'; @@ -101,5 +102,4 @@ for my $name (sort keys %$test_accessors) { } }; -# important -1; \ No newline at end of file +done_testing unless $::SUBTESTING; diff --git a/t/accessors_xs.t b/t/accessors_xs.t index edb5b48..eecf45c 100644 --- a/t/accessors_xs.t +++ b/t/accessors_xs.t @@ -22,10 +22,14 @@ BEGIN { } # rerun the regular 3 tests under XSAccessor +our $SUBTESTING = 1; $Class::Accessor::Grouped::USE_XS = 1; -for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t clean_namespace.t/) { - subtest "$tname with USE_XS (pass $_)" => sub { +for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t/) { + + for (1,2) { + note "\nTesting $tname with USE_XS (pass $_)\n\n"; + my $tfn = catfile($Bin, $tname); for ( @@ -42,8 +46,7 @@ for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t clean_namespace.t/) local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /subroutine .+ redefined/i }; do($tfn); - - } for (1 .. 2); + } } done_testing; diff --git a/t/illegal_name.t b/t/illegal_name.t index d73b254..0c4f5d5 100644 --- a/t/illegal_name.t +++ b/t/illegal_name.t @@ -1,4 +1,4 @@ -use Test::More tests => 4; +use Test::More; use Test::Exception; use strict; use warnings; @@ -19,7 +19,7 @@ use AccessorGroupsSubclass; is($warned, 3, 'Correct amount of unise warnings'); } -{ +if (eval { require Sub::Name } ) { my $warned = 0; local $SIG{__WARN__} = sub { $_[0] =~ /Installing illegal accessor/ ? $warned++ : warn(@_) @@ -43,4 +43,5 @@ throws_ok { local $ENV{CAG_ILLEGAL_ACCESSOR_NAME_OK} = 1; AccessorGroupsSubclass->mk_group_accessors(simple => "2wr\0vwrv;") } qr/nulls should never appear/; -1; + +done_testing;