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
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;
10use File::Basename;
11
12use CPANPLUS::Internals::Constants;
13use CPANPLUS::Module::Fake;
14use CPANPLUS::Module::Author::Fake;
15use CPANPLUS::Configure;
16use CPANPLUS::Backend;
17
18my $conf = gimme_conf();
19
20my $cb = CPANPLUS::Backend->new( $conf );
21
22my $f_auth = CPANPLUS::Module::Author::Fake->new( _id => $cb->_id );
23ok( $f_auth, "Fake auth object created" );
24ok( IS_AUTHOBJ->( $f_auth ), " IS_AUTHOBJ recognizes it" );
25ok( IS_FAKE_AUTHOBJ->( $f_auth ), " IS_FAKE_AUTHOBJ recognizes it" );
26
27my $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 );
33ok( $f_mod, "Fake mod object created" );
34ok( IS_MODOBJ->( $f_mod ), " IS_MODOBJ recognizes it" );
35ok( IS_FAKE_MODOBJ->( $f_mod ), " IS_FAKE_MODOJB recognizes it" );
36
37ok( IS_CONFOBJ->( conf => $conf ), "IS_CONFOBJ recognizes conf object" );
38
39ok( FILE_EXISTS->( file => basename($0) ), "FILE_EXISTS finds file" );
40ok( FILE_READABLE->( file => basename($0) ), "FILE_READABLE finds file" );
41ok( 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: