tagged release 0.6.4
[parrot.git] / t / steps / auto_env-02.t
blob7adb8c4d63f5d262043113ca30e500abeabd9f19
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_env-02.t
6 use strict;
7 use warnings;
8 use Test::More tests =>  13;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::env');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 my $args = process_options( {
18     argv            => [],
19     mode            => q{configure},
20 } );
22 my $conf = Parrot::Configure->new();
24 test_step_thru_runstep($conf, q{init::defaults}, $args);
26 my ($task, $step_name, $step, $ret);
27 my $pkg = q{auto::env};
29 $conf->add_steps($pkg);
30 $conf->options->set(%{$args});
31 $task = $conf->steps->[-1];
32 $step_name   = $task->step;
34 $step = $step_name->new();
35 ok(defined $step, "$step_name constructor returned defined value");
36 isa_ok($step, $step_name);
39 my ($setenv, $unsetenv);
41 $setenv = 1;
42 $unsetenv = 1;
43 $step->_evaluate_env($conf, $setenv, $unsetenv);
44 is($step->result(), q{both}, "Got expected result");
46 $setenv = 1;
47 $unsetenv = 0;
48 $step->_evaluate_env($conf, $setenv, $unsetenv);
49 is($step->result(), q{setenv}, "Got expected result");
51 $setenv = 0;
52 $unsetenv = 1;
53 $step->_evaluate_env($conf, $setenv, $unsetenv);
54 is($step->result(), q{unsetenv}, "Got expected result");
56 $setenv = 0;
57 $unsetenv = 0;
58 $step->_evaluate_env($conf, $setenv, $unsetenv);
59 is($step->result(), q{no}, "Got expected result");
62 pass("Completed all tests in $0");
64 ################### DOCUMENTATION ###################
66 =head1 NAME
68 auto_env-02.t - test config::auto::env
70 =head1 SYNOPSIS
72     % prove t/steps/auto_env-02.t
74 =head1 DESCRIPTION
76 The files in this directory test functionality used by F<Configure.pl>.
78 The tests in this file test config::auto::env::_evaluate_env(), an
79 internal subroutine, in the various permutations of having or lacking
80 C<setenv> and C<unsetenv>.
82 =head1 AUTHOR
84 James E Keenan
86 =head1 SEE ALSO
88 config::auto::env, F<Configure.pl>.
90 =cut
92 # Local Variables:
93 #   mode: cperl
94 #   cperl-indent-level: 4
95 #   fill-column: 100
96 # End:
97 # vim: expandtab shiftwidth=4: