2 # Copyright (C) 2007, The Perl Foundation.
9 plan( skip_all => 'Macports is Darwin only' ) unless $^O =~ /darwin/;
13 use File::Temp qw( tempdir );
14 use lib qw( lib t/configure/testlib );
15 use_ok('config::init::defaults');
16 use_ok('config::auto::macports');
18 use Parrot::Configure;
19 use Parrot::Configure::Options qw( process_options );
20 use Parrot::Configure::Test qw( test_step_thru_runstep);
22 my $args = process_options( {
27 my $conf = Parrot::Configure->new();
29 test_step_thru_runstep($conf, q{init::defaults}, $args);
31 my ($task, $step_name, $step, $ret);
32 my $pkg = q{auto::macports};
34 $conf->add_steps($pkg);
35 $conf->options->set(%{$args});
36 $task = $conf->steps->[-1];
37 $step_name = $task->step;
39 $step = $step_name->new();
40 ok(defined $step, "$step_name constructor returned defined value");
41 isa_ok($step, $step_name);
45 my $tdir = tempdir( CLEANUP => 1 );
46 $step->{ports_root} = $tdir;
47 ok(chdir $tdir, "Able to change to temporary directory");
48 ok( (mkdir 'lib'), "Able to make lib directory");
49 ok( (mkdir 'include'), "Able to make include directory");
51 ok($step->runstep($conf), "runstep() returned true value");
52 is($step->result(), q{yes}, "Got expected result");
54 is($conf->data->get('ports_base_dir'), $tdir,
55 "ports base directory set as expected");
56 is($conf->data->get('ports_lib_dir'), qq{$tdir/lib},
57 "ports 'lib' directory set as expected");
58 is($conf->data->get('ports_include_dir'), qq{$tdir/include},
59 "ports 'include' directory set as expected");
61 ok(chdir $cwd, "Able to change back to original directory after testing");
64 pass("Completed all tests in $0");
66 ################### DOCUMENTATION ###################
70 auto_macports-03.t - test config::auto::macports
74 % prove t/steps/auto_macports-03.t
78 The files in this directory test functionality used by F<Configure.pl>.
80 The tests in this file test config::auto::macports by mocking the case where
81 the expected default directories for Macports are found.
89 config::auto::macports, F<Configure.pl>.
95 # cperl-indent-level: 4
98 # vim: expandtab shiftwidth=4: