avoid needing . in @INC in dev mode
[p5sagit/Sub-Exporter-Progressive.git] / t / version-check.t
1
2 use strict;
3 use warnings;
4 use Test::More;
5
6 BEGIN {
7    package AAA;
8    our $VERSION = 2;
9    use Sub::Exporter::Progressive -setup => {
10       exports => ['aaa'],
11    };
12    sub aaa { 'aaa' };
13    $INC{'AAA.pm'} = __FILE__;
14 };
15
16 ok(eval('use AAA 1; 1'), 'perl built-in module version check');
17
18 {
19    local $@;
20    ok(!eval('use AAA 3; 1'), 'perl built-in module version check');
21    like(
22       $@,
23       qr/^AAA version 3 required/,
24       'perl built-in module version check error message',
25    );
26 }
27
28 {
29    local $@;
30    ok(
31       !eval('use AAA aaa => 1; 1'),
32       'Exporter.pm-style version check',
33    );
34    like(
35       $@,
36       qr{^cannot export symbols with a leading digit: '1'},
37       'Sub::Exporter::Progressive error message',
38    );
39 }
40
41 done_testing;
42