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