split extras testing into separate file and make it more robust
[p5sagit/strictures.git] / t / strictures.t
CommitLineData
5ab06a4d 1BEGIN { delete $ENV{PERL_STRICTURES_EXTRA} }
2
eae006ee 3use Test::More qw(no_plan);
4
5our (@us, @expect);
6
7sub capture_stuff { [ $^H, ${^WARNING_BITS} ] }
8
9sub capture_us { push @us, capture_stuff }
10sub capture_expect { push @expect, capture_stuff }
11
12{
5ab06a4d 13 BEGIN { $ENV{PERL_STRICTURES_EXTRA} = 0 }
eae006ee 14 use strictures 1;
15 BEGIN { capture_us }
5ab06a4d 16 BEGIN { delete $ENV{PERL_STRICTURES_EXTRA} }
eae006ee 17}
18
19{
20 use strict;
21 use warnings FATAL => 'all';
22 BEGIN { capture_expect }
23}
24
25# I'm assuming here we'll have more cases later. maybe not. eh.
26
27foreach my $idx (0 .. $#us) {
28 is($us[$idx][0], $expect[$idx][0], 'Hints ok for case '.($idx+1));
29 is($us[$idx][1], $expect[$idx][1], 'Warnings ok for case '.($idx+1));
30}
31
91b5f6b6 32my $v;
33eval { $v = strictures->VERSION; 1 } or diag $@;
34is $v, $strictures::VERSION, '->VERSION returns version correctly';
35
eae006ee 36ok(!eval q{use strictures 2; 1; }, "Can't use strictures 2 (this is version 1)");