2 # Copyright (C) 2009, Parrot Foundation.
8 use Test::More tests => 23;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::auto::neg_0');
12 use Parrot::Configure::Options qw( process_options );
13 use Parrot::Configure::Step::Test;
14 use Parrot::Configure::Test qw(
15 test_step_constructor_and_description
17 use IO::CaptureOutput 'capture';
19 ########### regular ###########
21 my ($args, $step_list_ref) = process_options(
28 my $conf = Parrot::Configure::Step::Test->new;
29 $conf->include_config_results( $args );
31 my $pkg = 'auto::neg_0';
33 $conf->add_steps($pkg);
35 my $serialized = $conf->pcfreeze();
37 $conf->options->set( %{$args} );
38 my $step = test_step_constructor_and_description($conf);
39 my $ret = $step->runstep($conf);
40 ok( $ret, 'runstep() returned true value' );
41 ok( defined $step->result(), 'A result has been defined');
43 $conf->replenish($serialized);
45 ##### _evaluate_cc_run() #####
47 ($args, $step_list_ref) = process_options(
53 $conf->options->set( %{$args} );
54 $step = test_step_constructor_and_description($conf);
57 my $orig_has_neg_0 = 0;
61 is( $step->_evaluate_cc_run($conf, $d_neg_0, $orig_has_neg_0),
63 '_evaluate_cc_run() completed satisfactorily' );
65 is( $step->result(), 'yes', 'Got expected result');
69 is( $step->_evaluate_cc_run($conf, $d_neg_0, $orig_has_neg_0),
71 '_evaluate_cc_run() completed satisfactorily' );
72 is( $step->result(), 'no', 'Got expected result' );
74 $conf->replenish($serialized);
76 ########## --verbose; _evaluate_cc_run() ##########
78 ($args, $step_list_ref) = process_options( {
79 argv => [ q{--verbose} ],
83 $conf->add_steps($pkg);
84 $conf->options->set( %{$args} );
85 $step = test_step_constructor_and_description($conf);
91 my ($stdout, $stderr);
94 $has_neg_0 = $step->_evaluate_cc_run(
95 $conf, $d_neg_0, $orig_has_neg_0
101 'Got expected return value from _evaluate_cc_run()' );
102 is( $step->result(), 'yes', 'Got expected result: yes' );
103 like( $stdout, qr/\(yes\)/, 'Got expected verbose output' );
108 my ($stdout, $stderr);
111 $has_neg_0 = $step->_evaluate_cc_run(
112 $conf, $d_neg_0, $orig_has_neg_0
118 'Got expected return value from _evaluate_cc_run()' );
119 is( $step->result(), 'no', 'Got expected result: no' );
120 like( $stdout, qr/\(no\)/, 'Got expected verbose output' );
123 pass("Completed all tests in $0");
125 ################### DOCUMENTATION ###################
129 auto_neg_0-01.t - test auto::neg_0
133 % prove t/steps/auto_neg_0-01.t
137 The files in this directory test functionality used by F<Configure.pl>.
139 The tests in this file test auto::neg_0.
147 config::auto::neg_0, F<Configure.pl>.
153 # cperl-indent-level: 4
156 # vim: expandtab shiftwidth=4: