Use CleanupTask to ensure tool always, automatically cleans up. Move create triggers step before copy rows, to keep related code together.

This commit is contained in:
Daniel Nichter
2012-03-28 18:40:23 -06:00
parent 02b3574582
commit 6c83106ce8
2 changed files with 289 additions and 168 deletions

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 2;
use Test::More tests => 4;
use PerconaTest;
use CleanupTask;
@@ -30,6 +30,23 @@ is(
"Cleanup task called after obj destroyed"
);
$foo = 0;
my $set_foo = new CleanupTask(sub { $foo = 42; });
is(
$foo,
0,
"Cleanup task not called yet"
);
$set_foo = undef;
is(
$foo,
42,
"Cleanup task called after obj=undef"
);
# #############################################################################
# Done.
# #############################################################################