2 # Copyright (C) 2007, Parrot Foundation.
4 # 017-revision_from_cache.t
11 "\nRelevant only when working in checkout from repository and during configuration" )
12 unless (-e 'DEVELOPING' and ! -e 'Makefile');
18 use File::Temp qw| tempdir |;
24 my ($cache, $libdir) = setup_cache($rev, $cwd);
25 require Parrot::Revision;
27 is($Parrot::Revision::current, $rev,
28 "Got expected revision number from cache");
30 unlink qq{$libdir/Parrot/Revision.pm}
31 or croak "Unable to delete file after testing";
32 ok( chdir $cwd, "Able to change back to starting directory");
35 pass("Completed all tests in $0");
37 ##### SUBROUTINES #####
41 my $tdir = tempdir( CLEANUP => 1 );
42 ok( chdir $tdir, "Changed to temporary directory for testing" );
43 my $libdir = qq{$tdir/lib};
44 ok( (File::Path::mkpath( [ $libdir ], 0, 0777 )), "Able to make libdir");
46 unshift @INC, $libdir;
47 ok( (File::Path::mkpath( [ qq{$libdir/Parrot} ], 0, 0777 )), "Able to make Parrot dir");
48 ok( (copy qq{$cwd/lib/Parrot/Revision.pm},
49 qq{$libdir/Parrot}), "Able to copy Parrot::Revision");
50 my $cache = q{.parrot_current_rev};
51 open my $FH, ">", $cache
52 or croak "Unable to open $cache for writing";
54 close $FH or croak "Unable to close $cache after writing";
55 return ($cache, $libdir);
58 ################### DOCUMENTATION ###################
62 017-revision_from_cache.t - test Parrot::Revision
66 % prove t/configure/017-revision_from_cache.t
70 The files in this directory test functionality used by F<Configure.pl>.
72 The tests in this file test Parrot::Revision (F<lib/Parrot/Revision.pm>).
80 Parrot::Configure, F<Configure.pl>.
86 # cperl-indent-level: 4
89 # vim: expandtab shiftwidth=4: