~percona-toolkit-dev/percona-toolkit/fix-password-comma-bug-886077

« back to all changes in this revision

Viewing changes to t/lib/CleanupTask.t

  • Committer: Daniel Nichter
  • Date: 2012-02-07 20:10:11 UTC
  • mfrom: (174 2.0)
  • mto: This revision was merged to the branch mainline in revision 189.
  • Revision ID: daniel@percona.com-20120207201011-sok2c1f2ay9qr3gm
Merge trunk r174.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
BEGIN {
 
4
   die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
 
5
      unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
 
6
   unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
 
7
};
 
8
 
 
9
use strict;
 
10
use warnings FATAL => 'all';
 
11
use English qw(-no_match_vars);
 
12
use Test::More tests => 2;
 
13
 
 
14
use PerconaTest;
 
15
use CleanupTask;
 
16
 
 
17
my $foo = 0;
 
18
{
 
19
   my $set_foo = new CleanupTask(sub { $foo = 42; });
 
20
   is(
 
21
      $foo,
 
22
      0,
 
23
      "Cleanup task not called yet"
 
24
   );
 
25
}
 
26
 
 
27
is(
 
28
   $foo,
 
29
   42,
 
30
   "Cleanup task called after obj destroyed"
 
31
);
 
32
 
 
33
# #############################################################################
 
34
# Done.
 
35
# #############################################################################
 
36
exit;