2 # Copyright (C) 2007, Parrot Foundation.
9 use Test::More tests => 10;
13 use File::Temp qw| tempdir |;
14 use lib qw( lib t/configure/testlib );
15 use Parrot::BuildUtil;
16 use Make_VERSION_File qw| make_VERSION_file |;
20 my $tdir = tempdir( CLEANUP => 1 );
21 ok( chdir $tdir, "Changed to temporary directory for testing" );
22 ok( ( mkdir "lib" ), "Able to make directory lib" );
23 ok( ( mkdir "lib/Parrot" ), "Able to make directory lib/Parrot" );
25 # Case 6: Installed copy of Parrot
26 my $installed_dir = q{lib/Parrot/something};
27 ok( ( mkdir $installed_dir ), "Able to make directory $installed_dir" );
28 ok( chdir $installed_dir,
29 "Changed deeper into temporary directory for testing" );
30 make_VERSION_file(q{0.4.11});
31 ok( chdir $tdir, "Changed back to temporary directory" );
33 $pv = Parrot::BuildUtil::parrot_version($installed_dir);
35 "Correct version number returned in scalar context" );
36 @pv = Parrot::BuildUtil::parrot_version($installed_dir);
37 is_deeply( \@pv, [ 0, 4, 11 ],
38 "Correct version number returned in list context" );
40 unlink qq{$installed_dir/VERSION}
41 or croak "Unable to delete file from tempdir after testing";
42 ok( chdir $cwd, "Able to change back to directory after testing" );
45 pass("Completed all tests in $0");
47 ################### DOCUMENTATION ###################
51 024-version.t - test C<Parrot::BuildUtil::parrot_version()>
55 % prove t/configure/024-version.t
59 The files in this directory test functionality used by F<Configure.pl>.
61 The tests in this file test Parrot::BuildUtil (F<lib/Parrot/BuildUtil.pm>).
69 Parrot::BuildUtil, F<Configure.pl>.
75 # cperl-indent-level: 4
78 # vim: expandtab shiftwidth=4: