2 # Copyright (C) 2007, Parrot Foundation.
8 use Test::More tests => 12;
12 use File::Temp qw(tempdir);
14 use_ok('config::init::manifest');
15 use Parrot::Configure;
16 use Parrot::Configure::Options qw( process_options );
17 use IO::CaptureOutput qw | capture |;
19 ########## no manifest check ##########
21 my $pkg = q{init::manifest};
22 my ($args, $step_list_ref) = process_options(
24 argv => [q{--nomanicheck}],
29 my $conf = Parrot::Configure->new;
30 $conf->add_steps($pkg);
32 my $serialized = $conf->pcfreeze();
34 $conf->options->set( %{$args} );
36 my $task = $conf->steps->[-1];
37 my $step_name = $task->step;
39 my $step = $step_name->new();
40 ok( defined $step, "$step_name constructor returned defined value" );
41 isa_ok( $step, $step_name );
42 ok( $step->description(), "$step_name has description" );
44 ok(defined ($step->result), "result defined");
45 ok(! ($step->result), "result not yet true");
46 my $ret = $step->runstep($conf);
47 ok( defined $ret, "runstep() returned defined value" );
48 is( $step->result, q{skipped},
49 "Because of --nomanicheck, result is 'skipped'." );
51 $conf->replenish($serialized);
53 ########## mock missing files ##########
55 ($args, $step_list_ref) = process_options(
61 $conf->options->set( %{$args} );
63 $task = $conf->steps->[-1];
64 $step_name = $task->step;
66 $step = $step_name->new();
67 ok( defined $step, "$step_name constructor returned defined value" );
68 isa_ok( $step, $step_name );
72 my $tdir = tempdir( CLEANUP => 1 );
73 chdir $tdir or croak "Unable to change to tempdir";
74 copy( qq{$cwd/MANIFEST}, qq{$tdir/MANIFEST} )
75 or croak "Unable to copy MANIFEST";
77 my ($rv, $stdout, $stderr);
79 sub { $rv = $step->runstep($conf); },
83 is( $rv, undef, "runstep returned undef" );
85 unlink qq{$tdir/MANIFEST}
86 or croak "Unable to delete file after testing";
87 chdir $cwd or croak "Unable to change back";
90 pass("Completed all tests in $0");
92 ################### DOCUMENTATION ###################
96 init/manifest-01.t - test init::manifest
100 % prove t/steps/init/manifest-01.t
104 The files in this directory test functionality used by F<Configure.pl>.
106 The tests in this file test methods found in config::init::manifest.
114 config::init::manifest, F<Configure.pl>.
120 # cperl-indent-level: 4
123 # vim: expandtab shiftwidth=4: