Silence the warning "Can't locate auto/POSIX/autosplit.ix in @INC"
[p5sagit/p5-mst-13.2.git] / lib / CPANPLUS / t / 06_CPANPLUS-Internals-Constants.t
1 ### make sure we can find our conf.pl file
2 BEGIN { 
3     use FindBin; 
4     require "$FindBin::Bin/inc/conf.pl";
5 }
6
7 use strict;
8 use Test::More 'no_plan';
9 use Cwd;
10 use File::Basename;
11
12 use CPANPLUS::Internals::Constants;
13 use CPANPLUS::Module::Fake;
14 use CPANPLUS::Module::Author::Fake;
15 use CPANPLUS::Configure;
16 use CPANPLUS::Backend;
17
18 my $conf = gimme_conf();
19
20 my $cb = CPANPLUS::Backend->new( $conf );
21
22 my $f_auth = CPANPLUS::Module::Author::Fake->new( _id => $cb->_id );
23 ok( $f_auth,                        "Fake auth object created" );
24 ok( IS_AUTHOBJ->( $f_auth ),        "   IS_AUTHOBJ recognizes it" );
25 ok( IS_FAKE_AUTHOBJ->( $f_auth ),   "   IS_FAKE_AUTHOBJ recognizes it" );
26
27 my $f_mod = CPANPLUS::Module::Fake->new(
28                 module  => TEST_CONF_INST_MODULE ,
29                 path    => 'some/where',
30                 package => 'Foo-Bar-1.2.tgz',
31                 _id     => $cb->_id,
32             );
33 ok( $f_mod,                     "Fake mod object created" );
34 ok( IS_MODOBJ->( $f_mod ),      "   IS_MODOBJ recognizes it" );
35 ok( IS_FAKE_MODOBJ->( $f_mod ), "   IS_FAKE_MODOJB recognizes it" );
36
37 ok( IS_CONFOBJ->( conf => $conf ),  "IS_CONFOBJ recognizes conf object" );
38
39 ok( FILE_EXISTS->( file => basename($0) ),      "FILE_EXISTS finds file" );
40 ok( FILE_READABLE->( file => basename($0) ),    "FILE_READABLE finds file" );
41 ok( DIR_EXISTS->( dir => cwd() ),               "DIR_EXISTS finds dir" );
42             
43
44 {   no strict 'refs';
45
46     my $tmpl = {
47         MAKEFILE_PL => 'Makefile.PL',
48         MAKEFILE    => 'Makefile',
49         BUILD_PL    => 'Build.PL',
50         BLIB        => 'blib',
51     };
52     
53     while ( my($sub,$res) = each %$tmpl ) {
54         is( &{$sub}->(), $res, "$sub returns proper result without args" );
55         
56         my $long = File::Spec->catfile( cwd(), $res );
57         is( &{$sub}->( cwd() ), $long, "$sub returns proper result with args" );
58     }       
59 }                               
60       
61 # Local variables:
62 # c-indentation-style: bsd
63 # c-basic-offset: 4
64 # indent-tabs-mode: nil
65 # End:
66 # vim: expandtab shiftwidth=4: