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;
61 close $FH or croak "Unable to close temp file after writing";
62 unshift( @INC, $tdir );
64 # need to capture the --verbose output,
65 # because the fact that it does not end
66 # in a newline confuses Test::Harness
70 capture ( sub {$rv = $step->runstep($conf)}, \$stdout);
71 ok( $stdout, "verbose output: hints were captured" );
72 ok( defined $rv, "$step_name runstep() returned defined value" );
74 unlink $localhints or croak "Unable to delete $localhints";
77 pass("Completed all tests in $0");
79 ################### DOCUMENTATION ###################
83 init_hints-02.t - test config::init::hints
87 % prove t/steps/init_hints-02.t
91 The files in this directory test functionality used by F<Configure.pl>.
93 The tests in this file test subroutines exported by config::init::hints.
101 config::init::hints, F<Configure.pl>.
107 # cperl-indent-level: 4
110 # vim: expandtab shiftwidth=4: