2 # Copyright (C) 2007, Parrot Foundation.
8 use Test::More tests => 20;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::auto::headers');
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
14 use Parrot::Configure::Step::Test;
15 use Parrot::Configure::Test qw(
16 test_step_constructor_and_description
18 use IO::CaptureOutput qw | capture |;
20 ########## regular ##########
22 my ($args, $step_list_ref) = process_options(
29 my $conf = Parrot::Configure::Step::Test->new;
30 $conf->include_config_results( $args );
31 my $serialized = $conf->pcfreeze();
33 my $pkg = q{auto::headers};
35 $conf->add_steps($pkg);
36 $conf->options->set( %{$args} );
37 my $step = test_step_constructor_and_description($conf);
39 my $ret = $step->runstep($conf);
40 ok( $ret, "runstep() returned true value" );
41 is($step->result(), q{}, "Result is empty string as expected");
43 $conf->replenish($serialized);
45 ########## --verbose ##########
47 ($args, $step_list_ref) = process_options(
49 argv => [ q{--verbose} ],
54 $conf->add_steps($pkg);
55 $conf->options->set( %{$args} );
56 $step = test_step_constructor_and_description($conf);
60 capture ( sub {$rv = $step->runstep($conf) }, \$stdout);
61 ok( $stdout, "verbose output captured" );
62 ok( $rv, "runstep() returned true value" );
63 is($step->result(), q{}, "Result is empty string as expected");
66 $conf->replenish($serialized);
68 ########## _set_from_Config(); _list_extra_headers() ##########
70 ($args, $step_list_ref) = process_options(
77 $conf->add_steps($pkg);
78 $conf->options->set( %{$args} );
79 $step = test_step_constructor_and_description($conf);
81 auto::headers::_set_from_Config($conf);
82 ok(! $conf->data->get('i_niin'), "Mapping made correctly");
86 $conf->data->set( OSNAME_provisional => $os );
88 map {$_, 1} auto::headers::_list_extra_headers($conf);
89 ok($extra_headers{'sysmman.h'}, "Special header set for $os");
90 ok($extra_headers{'netdb.h'}, "Special header set for $os");
95 $conf->data->set( OSNAME_provisional => $os );
97 map {$_, 1} auto::headers::_list_extra_headers($conf);
98 ok($extra_headers{'sal.h'}, "Special header set for $os");
101 pass("Completed all tests in $0");
103 ################### DOCUMENTATION ###################
107 auto/headers-01.t - test auto::headers
111 % prove t/steps/auto/headers-01.t
115 The files in this directory test functionality used by F<Configure.pl>.
117 The tests in this file test auto::headers.
125 config::auto::headers, F<Configure.pl>.
131 # cperl-indent-level: 4
134 # vim: expandtab shiftwidth=4: