1#! perl 2# Copyright (C) 2010, Parrot Foundation. 3# 062-sha1.t 4 5use strict; 6use warnings; 7 8use Test::More; 9if (-e 'DEVELOPING' and ! -e 'Makefile') { 10 plan tests => 7; 11} 12else { 13 plan skip_all => 14 q{Relevant only when working in a development repo and prior to configuration}; 15} 16use Carp; 17use Cwd; 18use File::Copy; 19use File::Path (); 20use File::Temp qw| tempdir |; 21use lib qw( lib ); 22 23my $cwd = cwd(); 24{ 25 my $tdir = tempdir( CLEANUP => 1 ); 26 ok( chdir $tdir, "Changed to temporary directory for testing" ); 27 my $libdir = qq{$tdir/lib}; 28 ok( (File::Path::mkpath( [ $libdir ], 0, 0777 )), "Able to make libdir"); 29 30 local @INC = @INC; 31 unshift @INC, $libdir; 32 ok( (File::Path::mkpath( [ qq{$libdir/Parrot} ], 0, 0777 )), "Able to make Parrot dir"); 33 ok( (copy qq{$cwd/lib/Parrot/SHA1.pm}, 34 qq{$libdir/Parrot}), "Able to copy Parrot::SHA1"); 35 chdir $cwd; 36 require Parrot::SHA1; 37 { 38 no warnings 'once'; 39 TODO: { 40 like($Parrot::SHA1::current, qr/^[0-9a-f]{40}$/, 41 "Got git hash for sha1 number"); 42 }; 43 } 44 45 chdir $tdir; 46 unlink qq{$libdir/Parrot/SHA1.pm} 47 or croak "Unable to delete file after testing"; 48 ok( chdir $cwd, "Able to change back to starting directory"); 49} 50 51pass("Completed all tests in $0"); 52 53=head1 NAME 54 55062-sha1.t - test Parrot::SHA1 56 57=head1 SYNOPSIS 58 59 % prove t/configure/062-sha1.t 60 61=head1 DESCRIPTION 62 63The files in this directory test functionality used by F<Configure.pl>. 64 65The tests in this file test Parrot::SHA1 (F<lib/Parrot/SHA1.pm>). 66 67=head1 AUTHOR 68 69Jonathan "Duke" Leto 70 71=head1 SEE ALSO 72 73Parrot::Configure, F<Configure.pl>. 74 75=cut 76 77# Local Variables: 78# mode: cperl 79# cperl-indent-level: 4 80# fill-column: 100 81# End: 82# vim: expandtab shiftwidth=4: 83