add this
[sepia.git] / t / 01basic.t
blob72cbc0acc7949e7c470ce5264337d64376103ec9
1 #!/usr/bin/env perl
2 use Test::Simple tests => 15;
4 require Data::Dumper;
5 require Sepia;
6 require Sepia::Xref;
7 require Sepia::Debug;
8 ok(1, 'loaded');
10 Sepia::Xref::rebuild();
11 ok(1, 'rebuild');
13 sub all
15 my $ok = 1;
16 $ok &&= $_ for @_;
17 $ok;
20 my @loc1 = Sepia::location('Sepia::location');
21 ok($loc1[0][0] =~ /Sepia\.pm$/, 'location');
22 ok((grep { $_ eq 'Sepia::location' } Sepia::apropos('location')), 'apropos');
23 # 4 to here
24 sub apply_to_loc # 3 tests per call.
26 my $f = shift;
27 my $loc1 = $f->('location');
28 ok($loc1, 'location 1');
29 my $loc2 = $f->('Sepia::location');
30 ok($loc2, 'fullname location');
31 my $ok = 1;
32 ok(all(map { $loc1->[$_] eq $loc2->[$_] } 0..$#{$loc1}), 'sameness');
33 $loc1;
36 apply_to_loc(\&Sepia::Xref::callers);
37 apply_to_loc(\&Sepia::Xref::callees);
38 # 10 tests to here.
40 my @subs = Sepia::mod_subs('Sepia');
41 ok(all(map { defined &{"Sepia::$_"} } @subs), 'mod_subs');
42 if (exists $INC{'Module/Info.pm'}) {
43 ok(Sepia::module_info('Sepia', 'name') eq 'Sepia');
44 ok(Sepia::module_info('Sepia', 'version') eq $Sepia::VERSION);
45 ok(Sepia::module_info('Sepia', 'file') =~ /Sepia\.pm$/);
46 ok(Sepia::module_info('Sepia', 'is_core') == 0);
47 } else {
48 ok(1, 'skipped -- no Module::Info') for 1..4;
51 exit;