tagged release 0.6.4
[parrot.git] / t / steps / auto_macports-03.t
blob0f6dfc5754741678259c041aacd845021a4ea345
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_macports-03.t
6 use strict;
7 use warnings;
8 use Test::More;
9 plan( skip_all => 'Macports is Darwin only' ) unless $^O =~ /darwin/;
10 plan( tests => 18 );
11 use Carp;
12 use Cwd;
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( {
23     argv            => [],
24     mode            => q{configure},
25 } );
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);
43 my $cwd = cwd();
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 ###################
68 =head1 NAME
70 auto_macports-03.t - test config::auto::macports
72 =head1 SYNOPSIS
74     % prove t/steps/auto_macports-03.t
76 =head1 DESCRIPTION
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.
83 =head1 AUTHOR
85 James E Keenan
87 =head1 SEE ALSO
89 config::auto::macports, F<Configure.pl>.
91 =cut
93 # Local Variables:
94 #   mode: cperl
95 #   cperl-indent-level: 4
96 #   fill-column: 100
97 # End:
98 # vim: expandtab shiftwidth=4: