2 # Copyright (C) 2007, The Perl Foundation.
8 use Test::More tests => 11;
12 use File::Temp qw(tempdir);
13 use lib qw( lib t/configure/testlib );
14 use_ok('config::init::defaults');
15 use_ok('config::init::hints');
16 use Parrot::Configure;
17 use Parrot::Configure::Options qw( process_options );
18 use Parrot::Configure::Test qw( test_step_thru_runstep);
19 use IO::CaptureOutput qw | capture |;
21 my $args = process_options(
23 argv => [q{--verbose}],
28 my $conf = Parrot::Configure->new;
30 test_step_thru_runstep( $conf, q{init::defaults}, $args );
32 my ( $task, $step_name, $step, $ret );
33 my $pkg = q{init::hints};
35 $conf->add_steps($pkg);
36 $conf->options->set( %{$args} );
38 $task = $conf->steps->[-1];
39 $step_name = $task->step;
41 $step = $step_name->new();
42 ok( defined $step, "$step_name constructor returned defined value" );
43 isa_ok( $step, $step_name );
47 my $tdir = tempdir( CLEANUP => 1 );
48 File::Path::mkpath(qq{$tdir/init/hints})
49 or croak "Unable to create directory for local hints";
50 my $localhints = qq{$tdir/init/hints/local.pm};
51 open my $FH, '>', $localhints
52 or croak "Unable to open temp file for writing";
54 package init::hints::local;
58 close $FH or croak "Unable to close temp file after writing";
59 unshift( @INC, $tdir );
61 # need to capture the --verbose output,
62 # because the fact that it does not end
63 # in a newline confuses Test::Harness
67 capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
68 ok( $stdout, "verbose output: hints were captured" );
69 ok( defined $rv, "$step_name runstep() returned defined va lue" );
71 unlink $localhints or croak "Unable to delete $localhints";
74 pass("Completed all tests in $0");
76 ################### DOCUMENTATION ###################
80 init_hints-03.t - test config::init::hints
84 % prove t/steps/init_hints-03.t
88 The files in this directory test functionality used by F<Configure.pl>.
90 The tests in this file test subroutines exported by config::init::hints.
98 config::init::hints, F<Configure.pl>.
104 # cperl-indent-level: 4
107 # vim: expandtab shiftwidth=4: