tagged release 0.6.4
[parrot.git] / t / steps / auto_macports-04.t
blob930518919507b617c05552bfa2391c6355e25457
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_macports-01.t
6 use strict;
7 use warnings;
8 use Test::More tests => 12;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::macports');
14 use Parrot::Configure;
15 use Parrot::Configure::Options qw( process_options );
16 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 use IO::CaptureOutput qw( capture );
19 my $args = process_options( {
20     argv            => [ q{--verbose} ],
21     mode            => q{configure},
22 } );
24 my $conf = Parrot::Configure->new();
26 test_step_thru_runstep($conf, q{init::defaults}, $args);
28 my ($task, $step_name, $step, $ret);
29 my $pkg = q{auto::macports};
31 $conf->add_steps($pkg);
32 $conf->options->set(%{$args});
33 $task = $conf->steps->[-1];
34 $step_name   = $task->step;
36 $step = $step_name->new();
37 ok(defined $step, "$step_name constructor returned defined value");
38 isa_ok($step, $step_name);
40 # mock not Darwin
41 my $osname = 'foobar';
42 $conf->data->set_p5( 'OSNAME' => $osname );
44     my ($stdout, $stderr);
45     my $ret = capture sub { $step->runstep($conf) }, \$stdout, \$stderr;
46     ok($ret, "runstep() returned true value");
47     is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
48     like(
49         $stdout,
50         qr/^Operating system is $osname; Macports is Darwin only/,
51         "Got expected verbose output"
52     );
55 pass("Completed all tests in $0");
57 ################### DOCUMENTATION ###################
59 =head1 NAME
61 auto_macports-01.t - test config::auto::macports
63 =head1 SYNOPSIS
65     % prove t/steps/auto_macports-01.t
67 =head1 DESCRIPTION
69 The files in this directory test functionality used by F<Configure.pl>.
71 The tests in this file test config::auto::macports in the case where the OS is not
72 Darwin and verbose output has been requested.
74 =head1 AUTHOR
76 James E Keenan
78 =head1 SEE ALSO
80 config::auto::macports, F<Configure.pl>.
82 =cut
84 # Local Variables:
85 #   mode: cperl
86 #   cperl-indent-level: 4
87 #   fill-column: 100
88 # End:
89 # vim: expandtab shiftwidth=4: