diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-10-28 18:09:08 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2013-10-28 18:09:08 +0000 |
commit | 1f3ec55911f841590a62ed06becc2bd9131a5fc4 (patch) | |
tree | c5cc7c17e75fff9f97efbd575d464cb9da4f60e9 /t/version-check.t | |
download | Sub-Exporter-Progressive-tarball-1f3ec55911f841590a62ed06becc2bd9131a5fc4.tar.gz |
Sub-Exporter-Progressive-0.001011HEADSub-Exporter-Progressive-0.001011master
Diffstat (limited to 't/version-check.t')
-rw-r--r-- | t/version-check.t | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/version-check.t b/t/version-check.t new file mode 100644 index 0000000..5fe1062 --- /dev/null +++ b/t/version-check.t @@ -0,0 +1,42 @@ + +use strict; +use warnings; +use Test::More; + +BEGIN { + package AAA; + our $VERSION = 2; + use Sub::Exporter::Progressive -setup => { + exports => ['aaa'], + }; + sub aaa { 'aaa' }; + $INC{'AAA.pm'} = __FILE__; +}; + +ok(eval('use AAA 1; 1'), 'perl built-in module version check'); + +{ + local $@; + ok(!eval('use AAA 3; 1'), 'perl built-in module version check'); + like( + $@, + qr/^AAA version 3 required/, + 'perl built-in module version check error message', + ); +} + +{ + local $@; + ok( + !eval('use AAA aaa => 1; 1'), + 'Exporter.pm-style version check', + ); + like( + $@, + qr{^cannot export symbols with a leading digit: '1'}, + 'Sub::Exporter::Progressive error message', + ); +} + +done_testing; + |