From: Vincent Pit Date: Sun, 18 Jan 2009 15:46:09 +0000 (+0100) Subject: Convert t/23-clear.t to the new testing framework X-Git-Tag: v0.27~15 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=47fcdae90d7af36c40b950c1154fa2dd306b5edb;p=perl%2Fmodules%2FVariable-Magic.git Convert t/23-clear.t to the new testing framework --- diff --git a/t/23-clear.t b/t/23-clear.t index ec8f9aa..d07d4b0 100644 --- a/t/23-clear.t +++ b/t/23-clear.t @@ -3,28 +3,25 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 2 * 5 + 2 + 1; -use Variable::Magic qw/wizard cast/; +use Variable::Magic qw/cast/; -my $c = 0; -my $wiz = wizard clear => sub { ++$c }; -is($c, 0, 'clear : create wizard'); +use lib 't/lib'; +use Variable::Magic::TestWatcher; + +my $wiz = init 'clear', 'clear'; my @a = qw/a b c/; -cast @a, $wiz; -is($c, 0, 'clear : cast array'); +check { cast @a, $wiz } { }, 'cast array'; -@a = (); -is($c, 1, 'clear : clear array'); -ok(!defined $a[0], 'clear : clear array correctly'); +check { @a = () } { clear => 1 }, 'clear array'; +is_deeply \@a, [ ], 'clear: clear array correctly'; my %h = (foo => 1, bar => 2); -cast %h, $wiz; -is($c, 1, 'clear : cast hash'); +check { cast %h, $wiz } { }, 'cast hash'; -%h = (); -is($c, 2, 'clear : clear hash'); -ok(!(keys %h), 'clear : clear hash correctly'); +check { %h = () } { clear => 1 }, 'clear hash'; +is_deeply \%h, { }, 'clear: clear hash correctly';