2 # Copyright (C) 2007-2010, Parrot Foundation.
9 use Test::More tests => 13;
12 use File::Temp qw( tempdir );
17 q{Relevant only when working in checkout from repository},
19 unless (-e 'DEVELOPING');
21 use_ok('Parrot::Manifest');
24 my $file = q{MANIFEST};
25 my $skip = q{MANIFEST.SKIP};
27 my $mani = Parrot::Manifest->new( { script => $script, } );
28 isa_ok( $mani, 'Parrot::Manifest' );
30 ok( scalar( @{ $mani->{dirs} } ),
31 "Parrot::Manifest constructor used 'status' command to find at least 1 directory." );
32 ok( scalar( @{ $mani->{versioned_files} } ),
33 "Parrot::Manifest constructor used 'status' command to find at least 1 versioned file." );
35 my $manifest_lines_ref = $mani->prepare_manifest();
36 is( ref($manifest_lines_ref), q{HASH}, "prepare_manifest() returned hash ref" );
40 my $tdir = tempdir( CLEANUP => 1 );
42 or croak "Unable to change to temporary directory for testing";
43 ok( !-f $file, "No $file yet in this directory" );
44 $mani->print_manifest($manifest_lines_ref);
45 ok( -f $file, "$file has been created in this directory" );
47 or croak "Unable to change back from temporary directory after testing";
50 my $print_str = $mani->prepare_manifest_skip();
51 ok( $print_str, "prepare_manifest_skip() returned" );
54 my $tdir = tempdir( CLEANUP => 1 );
56 or croak "Unable to change to temporary directory for testing";
57 ok( !-f $skip, "No $skip yet in tempdir" );
58 my $need_for_skip = $mani->determine_need_for_manifest_skip($print_str);
59 ok( $need_for_skip, "No $skip in tempdir; it must be regenerated" );
60 ok( $mani->print_manifest_skip($print_str), "print_manifest_skip() returned true" );
61 ok( -f $skip, "$skip has been created in tempdir" );
63 or croak "Unable to change back from temporary directory after testing";
67 pass("Completed all tests in $0");
69 ################### DOCUMENTATION ###################
73 01-basic.t - test C<Parrot::Manifest> constructor
77 % prove t/manifest/01-basic.t
81 The files in this directory test the publicly callable methods of
82 F<lib/Parrot/Manifest.pm> and packages which inherit from that package.
84 F<01-basic.t> tests whether the Parrot::Manifest methods work properly under
89 James E Keenan (jkeenan@cpan.org)
93 Parrot::Manifest, Parrot::Manifest::Files, Parrot::Manifest::Skip,
94 F<tools/dev/mk_manifest_and_skip.pl>.
100 # cperl-indent-level: 4
103 # vim: expandtab shiftwidth=4: