2 # Copyright (C) 2007, The Perl Foundation.
8 use Test::More tests => 16;
11 use lib qw( lib t/configure/testlib );
12 use_ok('config::init::defaults');
13 use_ok('config::auto::gdbm');
14 use Parrot::Configure;
15 use Parrot::Configure::Options qw( process_options );
16 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 use IO::CaptureOutput qw| capture |;
19 my $args = process_options(
21 argv => [ q{--without-gdbm} ],
26 my $conf = Parrot::Configure->new;
28 test_step_thru_runstep( $conf, q{init::defaults}, $args );
30 my $pkg = q{auto::gdbm};
32 $conf->add_steps($pkg);
33 $conf->options->set( %{$args} );
35 my ($task, $step_name, $step);
36 $task = $conf->steps->[-1];
37 $step_name = $task->step;
39 $step = $step_name->new();
40 ok( defined $step, "$step_name constructor returned defined value" );
41 isa_ok( $step, $step_name );
44 my ($test, $has_gdbm, $verbose);
46 $test = qq{gdbm is working.\n};
49 $has_gdbm = $step->_evaluate_cc_run($test, $has_gdbm, $verbose);
50 is($has_gdbm, 1, "'has_gdbm' set as expected");
51 is($step->result(), 'yes', "Expected result was set");
52 # Prepare for next test
53 $step->set_result(undef);
58 $has_gdbm = $step->_evaluate_cc_run($test, $has_gdbm, $verbose);
59 is($has_gdbm, 0, "'has_gdbm' set as expected");
60 ok(! defined $step->result(), "Result is undefined, as expected");
64 $test = qq{gdbm is working.\n};
69 $step->_evaluate_cc_run($test, $has_gdbm, $verbose); },
72 is($has_gdbm, 1, "'has_gdbm' set as expected");
73 is($step->result(), 'yes', "Expected result was set");
74 like($stdout, qr/\(yes\)/, "Got expected verbose output");
75 # Prepare for next test
76 $step->set_result(undef);
79 pass("Completed all tests in $0");
81 ################### DOCUMENTATION ###################
85 auto_gdbm-03.t - test config::auto::gdbm
89 % prove t/steps/auto_gdbm-03.t
93 The files in this directory test functionality used by F<Configure.pl>.
95 The tests in this file test config::auto::gdbm.
103 config::auto::gdbm, F<Configure.pl>.
109 # cperl-indent-level: 4
112 # vim: expandtab shiftwidth=4: