~ubuntu-branches/ubuntu/trusty/horae/trusty

« back to all changes in this revision

Viewing changes to 0CPAN/Pod-Simple-3.03/t/search_27_glob_squaa_kleene.t

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
use strict;
3
 
use Pod::Simple::Search;
4
 
use Test;
5
 
BEGIN { plan tests => 10 }
6
 
 
7
 
print "# ", __FILE__,
8
 
 ": Testing limit_glob ...\n";
9
 
 
10
 
my $x = Pod::Simple::Search->new;
11
 
die "Couldn't make an object!?" unless ok defined $x;
12
 
 
13
 
$x->inc(0);
14
 
$x->shadows(1);
15
 
 
16
 
use File::Spec;
17
 
use Cwd;
18
 
my $cwd = cwd();
19
 
print "# CWD: $cwd\n";
20
 
 
21
 
my($here1, $here2, $here3);
22
 
 
23
 
if(        -e ($here1 = File::Spec->catdir($cwd,      'test^lib'      ))) {
24
 
  die "But where's $here2?"
25
 
    unless -e ($here2 = File::Spec->catdir($cwd,      'other^test^lib'));
26
 
  die "But where's $here3?"
27
 
    unless -e ($here3 = File::Spec->catdir($cwd,      'yet^another^test^lib'));
28
 
 
29
 
} elsif(   -e ($here1 = File::Spec->catdir($cwd, 't', 'test^lib'      ))) {
30
 
  die "But where's $here2?"
31
 
    unless -e ($here2 = File::Spec->catdir($cwd, 't', 'other^test^lib'));
32
 
  die "But where's $here3?"
33
 
    unless -e ($here3 = File::Spec->catdir($cwd, 't', 'yet^another^test^lib'));
34
 
 
35
 
} else {
36
 
  die "Can't find the test corpora";
37
 
}
38
 
print "# OK, found the test corpora\n#  as $here1\n# and $here2\n# and $here3\n#\n";
39
 
ok 1;
40
 
 
41
 
print $x->_state_as_string;
42
 
#$x->verbose(12);
43
 
 
44
 
use Pod::Simple;
45
 
*pretty = \&Pod::Simple::BlackBox::pretty;
46
 
 
47
 
my $glob = 'squaa*';
48
 
print "# Limiting to $glob\n";
49
 
$x->limit_glob($glob);
50
 
 
51
 
my($name2where, $where2name) = $x->survey($here1, $here2, $here3);
52
 
 
53
 
my $p = pretty( $where2name, $name2where )."\n";
54
 
$p =~ s/, +/,\n/g;
55
 
$p =~ s/^/#  /mg;
56
 
print $p;
57
 
 
58
 
{
59
 
my $names = join "|", sort keys %$name2where;
60
 
ok $names, "squaa|squaa::Glunk|squaa::Vliff|squaa::Wowo";
61
 
}
62
 
 
63
 
{
64
 
my $names = join "|", sort values %$where2name;
65
 
ok $names, "squaa|squaa::Glunk|squaa::Vliff|squaa::Vliff|squaa::Vliff|squaa::Wowo";
66
 
 
67
 
my %count;
68
 
for(values %$where2name) { ++$count{$_} };
69
 
#print pretty(\%count), "\n\n";
70
 
delete @count{ grep $count{$_} < 2, keys %count };
71
 
my $shadowed = join "|", sort keys %count;
72
 
ok $shadowed, "squaa::Vliff";
73
 
 
74
 
sub thar { print "# Seen $_[0] :\n", map "#  {$_}\n", sort grep $where2name->{$_} eq $_[0],keys %$where2name; return; }
75
 
 
76
 
ok $count{'squaa::Vliff'}, 3;
77
 
thar 'squaa::Vliff';
78
 
}
79
 
 
80
 
 
81
 
ok   $name2where->{'squaa'};  # because squaa.pm IS squaa*
82
 
 
83
 
ok( ($name2where->{'squaa::Vliff'} || 'huh???'), '/[^\^]test\^lib/' );
84
 
 
85
 
ok( ($name2where->{'squaa::Wowo'}  || 'huh???'), '/other\^test\^lib/' );
86
 
 
87
 
 
88
 
print "# OK, bye from ", __FILE__, "\n";
89
 
ok 1;
90
 
 
91
 
__END__
92