fix up tests
[p5sagit/strictures.git] / t / strictures.t
CommitLineData
eae006ee 1use Test::More qw(no_plan);
2
3our (@us, @expect);
4
5sub capture_stuff { [ $^H, ${^WARNING_BITS} ] }
6
7sub capture_us { push @us, capture_stuff }
8sub capture_expect { push @expect, capture_stuff }
9
10{
11 use strictures 1;
12 BEGIN { capture_us }
13}
14
15{
16 use strict;
17 use warnings FATAL => 'all';
18 BEGIN { capture_expect }
19}
20
21# I'm assuming here we'll have more cases later. maybe not. eh.
22
23foreach my $idx (0 .. $#us) {
24 is($us[$idx][0], $expect[$idx][0], 'Hints ok for case '.($idx+1));
25 is($us[$idx][1], $expect[$idx][1], 'Warnings ok for case '.($idx+1));
26}
27
28{
29 local $0 = 't/00load.t';
30 sub Foo::new { 1 }
98b2be98 31 chdir("t/smells-of-vcs");
eae006ee 32 my $r = eval q{
33 use strictures 1;
34 new Foo 1, 2, 3;
35 };
36 # I don't test $@ here since if indirect isn't installed we hit one
37 # error and if it is we hit another; it's enough the code path's hit.
38 ok(!$r, 'strictures blows up for t/00load.t');
39}
40
41ok(!eval q{use strictures 2; 1; }, "Can't use strictures 2 (this is version 1)");