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