2 # Copyright (C) 2007, Parrot Foundation.
7 use Test::More tests => 36;
10 use File::Temp qw(tempdir);
11 use lib qw( lib t/configure/testlib );
12 use Parrot::Configure;
13 use Parrot::Configure::Options qw( process_options );
14 use_ok('config::init::install');
15 use Parrot::Configure::Test qw(
16 test_step_thru_runstep
17 test_step_constructor_and_description
22 my $tdir = tempdir( CLEANUP => 1 );
23 my $tdir1 = tempdir( CLEANUP => 1 );
24 my ($args, $step_list_ref) = process_options(
27 qq{--prefix=$tdir}, qq{--exec-prefix=$tdir},
28 qq{--bindir=$tdir1}, qq{--sbindir=$tdir1},
29 qq{--libexecdir=$tdir1}, qq{--datadir=$tdir1},
30 qq{--sysconfdir=$tdir1}, qq{--sharedstatedir=$tdir1},
31 qq{--localstatedir=$tdir1}, qq{--libdir=$tdir1},
32 qq{--includedir=$tdir1}, qq{--oldincludedir=$tdir1},
33 qq{--infodir=$tdir1}, qq{--mandir=$tdir1},
39 my $conf = Parrot::Configure->new;
41 my $serialized = $conf->pcfreeze();
43 test_step_thru_runstep( $conf, q{init::install}, $args );
45 is( $conf->data->get('prefix'), $tdir, "--prefix option confirmed" );
46 is( $conf->data->get('exec_prefix'), $tdir, "--exec-prefix option confirmed" );
47 is( $conf->data->get('bindir'), $tdir1, "--bindir option confirmed" );
48 is( $conf->data->get('sbindir'), $tdir1, "--sbindir option confirmed" );
49 is( $conf->data->get('libexecdir'), $tdir1, "--libexecdir option confirmed" );
50 is( $conf->data->get('datadir'), $tdir1, "--datadir option confirmed" );
51 is( $conf->data->get('sharedstatedir'), $tdir1, "--sharedstatedir option confirmed" );
52 is( $conf->data->get('localstatedir'), $tdir1, "--localstatedir option confirmed" );
53 is( $conf->data->get('libdir'), $tdir1, "--libdir option confirmed" );
54 is( $conf->data->get('includedir'), $tdir1, "--includedir option confirmed" );
55 is( $conf->data->get('oldincludedir'), $tdir1, "--oldincludedir option confirmed" );
56 is( $conf->data->get('infodir'), $tdir1, "--infodir option confirmed" );
57 is( $conf->data->get('mandir'), $tdir1, "--mandir option confirmed" );
59 $conf->replenish($serialized);
61 my $tdir2 = tempdir( CLEANUP => 1 );
62 my $tdir_orig = $tdir2;
64 my $tdir3 = tempdir( CLEANUP => 1 );
65 ($args, $step_list_ref) = process_options(
68 qq{--prefix=$tdir2}, qq{--exec-prefix=$tdir2},
69 qq{--bindir=$tdir3}, qq{--sbindir=$tdir3},
70 qq{--libexecdir=$tdir3}, qq{--datadir=$tdir3},
71 qq{--sysconfdir=$tdir3}, qq{--sharedstatedir=$tdir3},
72 qq{--localstatedir=$tdir3}, qq{--libdir=$tdir3},
73 qq{--includedir=$tdir3}, qq{--oldincludedir=$tdir3},
74 qq{--infodir=$tdir3}, qq{--mandir=$tdir3},
80 my $pkg = q{init::install};
81 $conf->add_steps($pkg);
82 $conf->options->set( %{$args} );
83 my $step = test_step_constructor_and_description($conf);
85 my $ret = $step->runstep($conf);
86 ok( defined $ret, "runstep() returned defined value" );
88 is( $conf->data->get('prefix'),
89 $tdir_orig, "--prefix option confirmed; trailing slash stripped" );
90 is( $conf->data->get('exec_prefix'),
91 $tdir_orig, "--exec-prefix option confirmed; trailing slash stripped" );
92 is( $conf->data->get('bindir'), $tdir3, "--bindir option confirmed" );
93 is( $conf->data->get('sbindir'), $tdir3, "--sbindir option confirmed" );
94 is( $conf->data->get('libexecdir'), $tdir3, "--libexecdir option confirmed" );
95 is( $conf->data->get('datadir'), $tdir3, "--datadir option confirmed" );
96 is( $conf->data->get('sharedstatedir'), $tdir3, "--sharedstatedir option confirmed" );
97 is( $conf->data->get('localstatedir'), $tdir3, "--localstatedir option confirmed" );
98 is( $conf->data->get('libdir'), $tdir3, "--libdir option confirmed" );
99 is( $conf->data->get('includedir'), $tdir3, "--includedir option confirmed" );
100 is( $conf->data->get('oldincludedir'), $tdir3, "--oldincludedir option confirmed" );
101 is( $conf->data->get('infodir'), $tdir3, "--infodir option confirmed" );
102 is( $conf->data->get('mandir'), $tdir3, "--mandir option confirmed" );
105 pass("Completed all tests in $0");
107 ################### DOCUMENTATION ###################
111 init/install-01.t - test init::install
115 % prove t/steps/init/install-01.t
119 The files in this directory test functionality used by F<Configure.pl>.
121 The tests in this file test init::install.
129 config::init::install, F<Configure.pl>.
135 # cperl-indent-level: 4
138 # vim: expandtab shiftwidth=4: