From: Vincent Pit Date: Sun, 4 Oct 2009 12:07:42 +0000 (+0200) Subject: A better t/01-import.t X-Git-Tag: v0.38~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=fa610aaeffe7ea7bcfdcac659811a64dc0fde6af;p=perl%2Fmodules%2FVariable-Magic.git A better t/01-import.t --- diff --git a/t/01-import.t b/t/01-import.t index 67cf438..8b6e055 100644 --- a/t/01-import.t +++ b/t/01-import.t @@ -3,18 +3,30 @@ use strict; use warnings; -use Test::More tests => 22; +use Test::More tests => 2 * 22; require Variable::Magic; -for (qw/wizard gensig getsig cast getdata dispell - SIG_MIN SIG_MAX SIG_NBR - MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR - VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID - VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_SCALAR_LENGTH_NOLEN - VMG_PERL_PATCHLEVEL - VMG_THREADSAFE VMG_FORKSAFE - VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/) { +my %syms = ( + wizard => undef, + gensig => '', + getsig => '$', + cast => '\[$@%&*]$@', + getdata => '\[$@%&*]$', + dispell => '\[$@%&*]$', + map { $_ => '' } qw/ + SIG_MIN SIG_MAX SIG_NBR + MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR + VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID + VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_SCALAR_LENGTH_NOLEN + VMG_PERL_PATCHLEVEL + VMG_THREADSAFE VMG_FORKSAFE + VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT + / +); + +for (sort keys %syms) { eval { Variable::Magic->import($_) }; - is($@, '', 'import ' . $_); + is $@, '', "import $_"; + is prototype($_), $syms{$_}, "prototype $_"; }