1package Test::Unit::Setup;
2use strict;
3
4use base qw(Test::Unit::Decorator);
5
6sub run {
7    my $self    = shift();
8    my($result) = @_;
9    my $protectable = sub {
10        $self->set_up();
11        $self->basic_run($result);
12        $self->tear_down();
13    };
14    $result->run_protected($self, $protectable);
15}
16
17# Sets up the fixture. Override to set up additional fixture
18# state.
19
20sub set_up {
21    print "Suite setup\n";
22}
23
24# Tears down the fixture. Override to tear down the additional
25# fixture state.
26
27sub tear_down {
28    print "Suite teardown\n";
29}
30
311;
32__END__
33
34
35=head1 NAME
36
37Test::Unit::Setup - unit testing framework helper class
38
39=head1 SYNOPSIS
40
41    # A Decorator to set up and tear down additional fixture state.
42    # Subclass Setup and insert it into your tests when you want
43    # to set up additional state once before the tests are run.
44
45=head1 DESCRIPTION
46
47A Decorator to set up and tear down additional fixture state.
48Subclass Setup and insert it into your tests when you want
49to set up additional state once before the tests are run.
50
51=head1 AUTHOR
52
53Copyright (c) 2001 Kevin Connor <kconnor@interwoven.com>
54
55All rights reserved. This program is free software; you can
56redistribute it and/or modify it under the same terms as
57Perl itself.
58
59=head1 SEE ALSO
60
61L<Test::Unit::TestCase>, L<Test::Unit::Exception>
62
63=cut
64