2 # Copyright (C) 2007, Parrot Foundation.
4 # 017-revision_from_cache.t
10 if (-e 'DEVELOPING' and ! -e 'Makefile') {
15 q{Relevant only when working in checkout from repository and prior to configuration};
21 use File::Temp qw| tempdir |;
27 my ($cache, $libdir) = setup_cache($rev, $cwd);
28 require Parrot::Revision;
30 is($Parrot::Revision::current, $rev,
31 "Got expected revision number from cache");
33 unlink qq{$libdir/Parrot/Revision.pm}
34 or croak "Unable to delete file after testing";
35 ok( chdir $cwd, "Able to change back to starting directory");
38 pass("Completed all tests in $0");
40 ##### SUBROUTINES #####
44 my $tdir = tempdir( CLEANUP => 1 );
45 ok( chdir $tdir, "Changed to temporary directory for testing" );
46 my $libdir = qq{$tdir/lib};
47 ok( (File::Path::mkpath( [ $libdir ], 0, 0777 )), "Able to make libdir");
49 unshift @INC, $libdir;
50 ok( (File::Path::mkpath( [ qq{$libdir/Parrot} ], 0, 0777 )), "Able to make Parrot dir");
51 ok( (copy qq{$cwd/lib/Parrot/Revision.pm},
52 qq{$libdir/Parrot}), "Able to copy Parrot::Revision");
53 my $cache = q{.parrot_current_rev};
54 open my $FH, ">", $cache
55 or croak "Unable to open $cache for writing";
57 close $FH or croak "Unable to close $cache after writing";
58 return ($cache, $libdir);
61 ################### DOCUMENTATION ###################
65 017-revision_from_cache.t - test Parrot::Revision
69 % prove t/configure/017-revision_from_cache.t
73 The files in this directory test functionality used by F<Configure.pl>.
75 The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>).
83 Parrot::Configure, F<Configure.pl>.
89 # cperl-indent-level: 4
92 # vim: expandtab shiftwidth=4: