2 # Copyright (C) 2007, The Perl Foundation.
8 use Test::More tests => 20;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::revision');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 my $args = process_options(
24 my $conf = Parrot::Configure->new;
26 test_step_thru_runstep( $conf, q{init::defaults}, $args );
28 my $pkg = q{auto::revision};
30 $conf->add_steps($pkg);
31 $conf->options->set( %{$args} );
33 my ( $task, $step_name, $step);
34 $task = $conf->steps->[1];
35 $step_name = $task->step;
37 $step = $step_name->new();
38 ok( defined $step, "$step_name constructor returned defined value" );
39 isa_ok( $step, $step_name );
40 ok( $step->description(), "$step_name has description" );
45 local $Parrot::Revision::current = $testrev;
46 $ret = $step->runstep($conf);
47 ok( $ret, "$step_name runstep() returned true value" );
48 is($conf->data->get('revision'), $testrev,
49 "'revision' element was set correctly");
50 is($step->result(), qq{r$testrev}, "Expected result was set");
55 local $Parrot::Revision::current = $testrev;
56 $ret = $step->runstep($conf);
57 ok( $ret, "$step_name runstep() returned true value" );
58 is($conf->data->get('revision'), $testrev,
59 "'revision' element was set correctly");
60 is($step->result(), q{done}, "Expected result was set");
65 local $Parrot::Revision::current = $testrev;
66 eval { $ret = $step->runstep($conf); };
67 like($@, qr/Cannot use non-numeric revision number/,
68 "Got expected error message");
73 local $Parrot::Revision::current = $testrev;
74 $ret = $step->runstep($conf);
75 ok( $ret, "$step_name runstep() returned true value" );
76 ok(! defined($conf->data->get('revision')),
77 "'revision' element is undefined as expected");
78 is($step->result(), q{done}, "Expected result was set");
81 pass("Completed all tests in $0");
83 ################### DOCUMENTATION ###################
87 auto_revision-01.t - test config::auto::revision
91 % prove t/steps/auto_revision-01.t
95 The files in this directory test functionality used by F<Configure.pl>.
97 The tests in this file test subroutines exported by config::auto::revision.
105 config::auto::revision, F<Configure.pl>.
111 # cperl-indent-level: 4
114 # vim: expandtab shiftwidth=4: