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() ) {
41 ### don't muck around with references/objects
42 ### or private identifiers
43 next if ref $auth->$type() or $type =~/^_/;
45 my @aref = $CB->search(
47 allow => [$auth->$type()],
50 ok( @aref, "Author found by '$type'" );
52 ok( IS_AUTHOBJ->($_), " Author isa author object" );
58 local $SIG{__WARN__} = sub { $warning .= "@_"; };
60 { ### try search that will yield nothing ###
61 ### XXX SOURCEFILES FIX
62 my @list = $CB->search( type => 'module',
63 allow => [$ModName.$$] );
65 is( scalar(@list), 0, "Valid search yields no results" );
66 is( $warning, '', " No warnings issued" );
69 { ### try bogus arguments ###
70 my @list = $CB->search( type => '', allow => ['foo'] );
72 is( scalar(@list), 0, "Broken search yields no results" );
73 like( $warning, qr/^Key 'type'.* is of invalid type for/,
74 " Got a warning for wrong arguments" );
79 # c-indentation-style: bsd
81 # indent-tabs-mode: nil
83 # vim: expandtab shiftwidth=4: