2 # Copyright (C) 2007, The Perl Foundation.
9 plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
13 use lib qw( lib t/configure/testlib );
14 use_ok('config::init::defaults');
15 use_ok('config::auto::fink');
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( {
22 argv => [ q{--verbose} ],
26 my $conf = Parrot::Configure->new();
28 test_step_thru_runstep($conf, q{init::defaults}, $args);
30 my ($task, $step_name, $step, $ret);
31 my $pkg = q{auto::fink};
33 $conf->add_steps($pkg);
34 $conf->options->set(%{$args});
35 $task = $conf->steps->[-1];
36 $step_name = $task->step;
38 $step = $step_name->new();
39 ok(defined $step, "$step_name constructor returned defined value");
40 isa_ok($step, $step_name);
43 # mock Fink config file with non-existent Basepath
44 my $tfile = File::Temp->new();
45 open my $fh, ">", $tfile
46 or croak "Unable to open temporary file for writing";
47 print $fh "Basepath: /my/phony/directory\n";
48 close $fh or croak "Unable to close temporary file after writing";
49 $step->{fink_conf} = $tfile;
53 sub { $rv = $step->runstep($conf); },
57 "runstep() returned undef due to unlocateable Fink directories");
58 is($step->result(), q{failed},
59 "Got expected result for unlocateable Fink directories");
61 qr/Could not locate Fink directories/,
62 "Got expected verbose output for unlocateable Fink directories");
65 pass("Completed all tests in $0");
67 ################### DOCUMENTATION ###################
71 auto_fink-09.t - test config::auto::fink
75 % prove t/steps/auto_fink-09.t
79 The files in this directory test functionality used by F<Configure.pl>.
81 The tests in this file test config::auto::fink in the case where the one or
82 more of the Fink directories cannot be located.
90 config::auto::fink, F<Configure.pl>.
96 # cperl-indent-level: 4
99 # vim: expandtab shiftwidth=4: