X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F33-code.t;h=40c32a4b00fff8e0cd40bf1ac1afbdbb884f64e4;hb=refs%2Ftags%2Fv0.14;hp=7b6339960c037a2df50fe280dfb70bb1de87b0dd;hpb=763ba8093427f3668368fa885741618ac6289d41;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/33-code.t b/t/33-code.t index 7b63399..40c32a4 100644 --- a/t/33-code.t +++ b/t/33-code.t @@ -11,8 +11,9 @@ my @c = (0) x 12; my @x = (0) x 12; sub check { - for (0 .. 11) { return 0 unless $c[$_] == $x[$_]; } - return 1; + is join(':', map { (defined) ? $_ : 'u' } @c[0 .. 11]), + join(':', map { (defined) ? $_ : 'u' } @x[0 .. 11]), + $_[0]; } my $i = -1; @@ -28,43 +29,43 @@ my $wiz = wizard get => sub { ++$c[0] }, store => sub { ++$c[9] }, 'exists' => sub { ++$c[10] }, 'delete' => sub { ++$c[11] }; -ok(check(), 'code : create wizard'); +check('code : create wizard'); my $x = 0; my $n = sub { ++$x }; my $a = $n; cast $a, $wiz; -ok(check(), 'code : cast'); +check('code : cast'); my $b = $a; ++$x[0]; -ok(check(), 'code : assign to'); +check('code : assign to'); $b = "X${a}Y"; ++$x[0]; -ok(check(), 'code : interpolate'); +check('code : interpolate'); $b = \$a; -ok(check(), 'code : reference'); +check('code : reference'); $a = $n; ++$x[1]; -ok(check(), 'code : assign'); +check('code : assign'); $a->(); -ok(check(), 'code : call'); +check('code : call'); { my $b = $n; cast $b, $wiz; } ++$x[4]; -ok(check(), 'code : scope end'); +check('code : scope end'); undef $a; ++$x[1]; -ok(check(), 'code : undef'); +check('code : undef'); dispell $a, $wiz; -ok(check(), 'code : dispell'); +check('code : dispell');