1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
use warnings;
use strict;
use Test::More tests => 53;
BEGIN { $SIG{__WARN__} = sub { die "WARNING: $_[0]" }; }
require_ok "Lexical::Var";
eval q{ Lexical::Var->import(); };
like $@, qr/\ALexical::Var does no default importation/;
eval q{ Lexical::Var->unimport(); };
like $@, qr/\ALexical::Var does no default unimportation/;
eval q{ Lexical::Var->import('foo'); };
like $@, qr/\Aimport list for Lexical::Var must alternate /;
eval q{ Lexical::Var->import('$foo', \1); };
like $@, qr/\Acan't set up Lexical::Var lexical variable outside compilation/;
eval q{ Lexical::Var->unimport('$foo'); };
like $@, qr/\Acan't set up Lexical::Var lexical variable outside compilation/;
eval q{ use Lexical::Var; };
like $@, qr/\ALexical::Var does no default importation/;
eval q{ no Lexical::Var; };
like $@, qr/\ALexical::Var does no default unimportation/;
eval q{ use Lexical::Var 'foo'; };
like $@, qr/\Aimport list for Lexical::Var must alternate /;
eval q{ use Lexical::Var undef, \1; };
like $@, qr/\Avariable name is not a string/;
eval q{ use Lexical::Var \1, sub{}; };
like $@, qr/\Avariable name is not a string/;
eval q{ use Lexical::Var undef, "wibble"; };
like $@, qr/\Avariable name is not a string/;
eval q{ use Lexical::Var 'foo', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '$', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '$foo(bar', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '$1foo', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '$foo\x{e9}bar', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '$foo::bar', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '!foo', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var 'foo', "wibble"; };
like $@, qr/\Amalformed variable name/;
eval q{ use Lexical::Var '$foo', "wibble"; };
like $@, qr/\Avariable is not scalar reference/;
eval q{ no Lexical::Var undef, \1; };
like $@, qr/\Avariable name is not a string/;
eval q{ no Lexical::Var \1, sub{}; };
like $@, qr/\Avariable name is not a string/;
eval q{ no Lexical::Var undef, "wibble"; };
like $@, qr/\Avariable name is not a string/;
eval q{ no Lexical::Var 'foo', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ no Lexical::Var '$', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ no Lexical::Var '$foo(bar', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ no Lexical::Var '$foo::bar', \1; };
like $@, qr/\Amalformed variable name/;
eval q{ no Lexical::Var '!foo', \1; };
like $@, qr/\Amalformed variable name/;
require_ok "Lexical::Sub";
eval q{ Lexical::Sub->import(); };
like $@, qr/\ALexical::Sub does no default importation/;
eval q{ Lexical::Sub->unimport(); };
like $@, qr/\ALexical::Sub does no default unimportation/;
eval q{ Lexical::Sub->import('foo'); };
like $@, qr/\Aimport list for Lexical::Sub must alternate /;
eval q{ use Lexical::Sub; };
like $@, qr/\ALexical::Sub does no default importation/;
eval q{ no Lexical::Sub; };
like $@, qr/\ALexical::Sub does no default unimportation/;
eval q{ use Lexical::Sub 'foo'; };
like $@, qr/\Aimport list for Lexical::Sub must alternate /;
eval q{ use Lexical::Sub undef, sub{}; };
like $@, qr/\Asubroutine name is not a string/;
eval q{ use Lexical::Sub sub{}, \1; };
like $@, qr/\Asubroutine name is not a string/;
eval q{ use Lexical::Sub undef, "wibble"; };
like $@, qr/\Asubroutine name is not a string/;
eval q{ use Lexical::Sub '$', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ use Lexical::Sub 'foo(bar', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ use Lexical::Sub '1foo', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ use Lexical::Sub 'foo\x{e9}bar', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ use Lexical::Sub 'foo::bar', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ use Lexical::Sub '!foo', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ use Lexical::Sub 'foo', "wibble"; };
like $@, qr/\Asubroutine is not code reference/;
eval q{ no Lexical::Sub undef, sub{}; };
like $@, qr/\Asubroutine name is not a string/;
eval q{ no Lexical::Sub sub{}, \1; };
like $@, qr/\Asubroutine name is not a string/;
eval q{ no Lexical::Sub undef, "wibble"; };
like $@, qr/\Asubroutine name is not a string/;
eval q{ no Lexical::Sub '$', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ no Lexical::Sub 'foo(bar', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ no Lexical::Sub 'foo::bar', sub{}; };
like $@, qr/\Amalformed subroutine name/;
eval q{ no Lexical::Sub '!foo', sub{}; };
like $@, qr/\Amalformed subroutine name/;
1;
|