X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F22-magic.t;h=8fef0f06d77563c8765cf9c64047c69c57d1bd80;hb=46563a4451087c17e95a7ec9d33eb7ff0cc674d4;hp=c6a517c8b2fa6d24c95ccf4de60c82d719677561;hpb=5c21bf6de3e2527b0fe556b5d67d785f1d686a8d;p=perl%2Fmodules%2FLexical-Types.git diff --git a/t/22-magic.t b/t/22-magic.t index c6a517c..8fef0f0 100644 --- a/t/22-magic.t +++ b/t/22-magic.t @@ -5,15 +5,17 @@ use warnings; use Test::More; +use lib 't/lib'; +use VPIT::TestHelpers; + BEGIN { - plan skip_all => 'Variable::Magic required to test magic' - unless eval "use Variable::Magic; 1"; + load_or_skip_all('Variable::Magic', undef, [ ]); } { package Lexical::Types::Test::Str; - use Variable::Magic qw/wizard cast/; + use Variable::Magic qw; our $wiz; BEGIN { @@ -21,7 +23,7 @@ BEGIN { get => sub { ++$_[1]->{get}; () }, set => sub { ++$_[1]->{set}; () }; } - + sub TYPEDSCALAR { cast $_[1], $wiz, $_[2]; () } } @@ -29,7 +31,6 @@ BEGIN { BEGIN { plan tests => 2 * 8; - defined and diag "Using Variable::Magic $_" for $Variable::Magic::VERSION; } use Lexical::Types as => 'Lexical::Types::Test'; @@ -40,7 +41,8 @@ sub check (&$$;$) { my $want = wantarray; my @ret; { - local @{$got}{qw/get set/}; delete @{$got}{qw/get set/}; + local @{$got}{qw}; + delete @{$got}{qw}; if ($want) { @ret = eval { $test->() }; } elsif (defined $want) { @@ -48,6 +50,7 @@ sub check (&$$;$) { } else { eval { $test->() }; } + local $Test::Builder::Level = $Test::Builder::Level + 1; is_deeply $got, $exp, $desc; } return $want ? @ret : $ret[0];