Update CPANPLUS to cpan version 0.89_12
[p5sagit/p5-mst-13.2.git] / cpan / CPANPLUS / t / 06_CPANPLUS-Internals-Constants.t
CommitLineData
6aaee015 1### make sure we can find our conf.pl file
2BEGIN {
3 use FindBin;
4 require "$FindBin::Bin/inc/conf.pl";
5}
6
7use strict;
8use Test::More 'no_plan';
9use Cwd;
5bc5f6dc 10use Config;
6aaee015 11use File::Basename;
12
13use CPANPLUS::Internals::Constants;
14use CPANPLUS::Module::Fake;
15use CPANPLUS::Module::Author::Fake;
16use CPANPLUS::Configure;
17use CPANPLUS::Backend;
18
19my $conf = gimme_conf();
20
21my $cb = CPANPLUS::Backend->new( $conf );
22
23my $f_auth = CPANPLUS::Module::Author::Fake->new( _id => $cb->_id );
24ok( $f_auth, "Fake auth object created" );
25ok( IS_AUTHOBJ->( $f_auth ), " IS_AUTHOBJ recognizes it" );
26ok( IS_FAKE_AUTHOBJ->( $f_auth ), " IS_FAKE_AUTHOBJ recognizes it" );
27
28my $f_mod = CPANPLUS::Module::Fake->new(
29 module => TEST_CONF_INST_MODULE ,
30 path => 'some/where',
31 package => 'Foo-Bar-1.2.tgz',
32 _id => $cb->_id,
33 );
34ok( $f_mod, "Fake mod object created" );
35ok( IS_MODOBJ->( $f_mod ), " IS_MODOBJ recognizes it" );
36ok( IS_FAKE_MODOBJ->( $f_mod ), " IS_FAKE_MODOJB recognizes it" );
37
38ok( IS_CONFOBJ->( conf => $conf ), "IS_CONFOBJ recognizes conf object" );
39
40ok( FILE_EXISTS->( file => basename($0) ), "FILE_EXISTS finds file" );
41ok( FILE_READABLE->( file => basename($0) ), "FILE_READABLE finds file" );
42ok( DIR_EXISTS->( dir => cwd() ), "DIR_EXISTS finds dir" );
43
44
45{ no strict 'refs';
46
47 my $tmpl = {
48 MAKEFILE_PL => 'Makefile.PL',
6aaee015 49 BUILD_PL => 'Build.PL',
50 BLIB => 'blib',
5bc5f6dc 51 MAKEFILE => do {
52 ### On vms, it's a different name. See constants
53 ### file for details
54 (ON_VMS and $Config::Config{make} =~ /MM[S|K]/i)
55 ? 'DESCRIP.MMS'
56 : 'Makefile'
57 },
6aaee015 58 };
59
60 while ( my($sub,$res) = each %$tmpl ) {
61 is( &{$sub}->(), $res, "$sub returns proper result without args" );
62
63 my $long = File::Spec->catfile( cwd(), $res );
64 is( &{$sub}->( cwd() ), $long, "$sub returns proper result with args" );
65 }
66}
67
68# Local variables:
69# c-indentation-style: bsd
70# c-basic-offset: 4
71# indent-tabs-mode: nil
72# End:
73# vim: expandtab shiftwidth=4: