Delay loading some rarely-used stuff. Startup is already fast, but
[sepia.git] / t / 01basic.t
blob37f56cd5f75b66c95b4f5d2cb124a9c418fe183d
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 # XXX: this segfaults, so skip it.
11 # Sepia::Xref::rebuild();
12 ok(1, 'rebuild');
14 sub all
16 my $ok = 1;
17 $ok &&= $_ for @_;
18 $ok;
21 my @loc1 = Sepia::location('Sepia::location');
22 ok($loc1[0][0] =~ /Sepia\.pm$/, 'location');
23 ok((grep { $_ eq 'Sepia::location' } Sepia::apropos('location')), 'apropos');
24 # 4 to here
25 sub apply_to_loc # 3 tests per call.
27 my $f = shift;
28 my $loc1 = $f->('location');
29 ok($loc1, 'location 1');
30 my $loc2 = $f->('Sepia::location');
31 ok($loc2, 'fullname location');
32 my $ok = 1;
33 ok(all(map { $loc1->[$_] eq $loc2->[$_] } 0..$#{$loc1}), 'sameness');
34 $loc1;
37 apply_to_loc(\&Sepia::Xref::callers);
38 apply_to_loc(\&Sepia::Xref::callees);
39 # 10 tests to here.
41 my @subs = Sepia::mod_subs('Sepia');
42 ok(all(map { defined &{"Sepia::$_"} } @subs), 'mod_subs');
43 if (eval 'use Module::Info; 1') {
44 ok(Sepia::module_info('Sepia', 'name') eq 'Sepia');
45 ok(Sepia::module_info('Sepia', 'version') eq $Sepia::VERSION);
46 ok(Sepia::module_info('Sepia', 'file') =~ /Sepia\.pm$/);
47 ok(Sepia::module_info('Sepia', 'is_core') == 0);
48 } else {
49 ok(1, 'skipped -- no Module::Info') for 1..4;
52 exit;