1 ### make sure we can find our conf.pl file
4 require "$FindBin::Bin/inc/conf.pl";
8 use Test::More 'no_plan';
10 use CPANPLUS::Backend;
11 use CPANPLUS::Internals::Constants;
13 my $Conf = gimme_conf();
14 my $CB = CPANPLUS::Backend->new($Conf);
15 my $ModName = TEST_CONF_MODULE;
16 my $Mod = $CB->module_tree( $ModName );
19 ### search for modules ###
20 for my $type ( CPANPLUS::Module->accessors() ) {
22 ### don't muck around with references/objects
23 ### or private identifiers
24 next if ref $Mod->$type() or $type =~/^_/;
26 my @aref = $CB->search(
28 allow => [$Mod->$type()],
31 ok( scalar @aref, "Module found by '$type'" );
33 ok( IS_MODOBJ->($_)," Module isa module object" );
37 ### search for authors ###
38 my $auth = $Mod->author;
39 for my $type ( CPANPLUS::Module::Author->accessors() ) {
40 my @aref = $CB->search(
42 allow => [$auth->$type()],
45 ok( @aref, "Author found by '$type'" );
47 ok( IS_AUTHOBJ->($_), " Author isa author object" );
53 local $SIG{__WARN__} = sub { $warning .= "@_"; };
55 { ### try search that will yield nothing ###
56 ### XXX SOURCEFILES FIX
57 my @list = $CB->search( type => 'module',
58 allow => [$ModName.$$] );
60 is( scalar(@list), 0, "Valid search yields no results" );
61 is( $warning, '', " No warnings issued" );
64 { ### try bogus arguments ###
65 my @list = $CB->search( type => '', allow => ['foo'] );
67 is( scalar(@list), 0, "Broken search yields no results" );
68 like( $warning, qr/^Key 'type'.* is of invalid type for/,
69 " Got a warning for wrong arguments" );
74 # c-indentation-style: bsd
76 # indent-tabs-mode: nil
78 # vim: expandtab shiftwidth=4: