initial
[sepia.git] / test.pl
blob60609d2c671137c93c8761f252e02af09920d74a
1 #!/usr/bin/env perl
2 use Test::Simple tests => 18;
4 require Data::Dumper;
5 require Sepia;
6 require Sepia::Xref;
7 ok(1, 'loaded');
9 Sepia::Xref::rebuild();
10 ok(1, 'rebuild');
12 sub all
14 my $ok = 1;
15 $ok &&= $_ for @_;
16 $ok;
19 my @loc1 = Sepia::location('Sepia::location');
20 ok($loc1[0][0] =~ /Sepia\.pm$/, 'location');
21 ok((grep { $_ eq 'Sepia::location' } Sepia::apropos('location')), 'apropos');
22 # 4 to here
23 sub apply_to_loc # 3 tests per call.
25 my $f = shift;
26 my $loc1 = $f->('location');
27 ok($loc1, 'location 1');
28 my $loc2 = $f->('Sepia::location');
29 ok($loc2, 'fullname location');
30 my $ok = 1;
31 ok(all(map { $loc1->[$_] eq $loc2->[$_] } 0..$#{$loc1}), 'sameness');
32 $loc1;
35 apply_to_loc(\&Sepia::Xref::callers);
36 apply_to_loc(\&Sepia::Xref::callees);
37 # 10 tests to here.
39 my @subs = Sepia::mod_subs('Sepia');
40 ok(all(map { defined &{"Sepia::$_"} } @subs), 'mod_subs');
41 ok(Sepia::module_info('Sepia', 'name') eq 'Sepia');
42 ok(Sepia::module_info('Sepia', 'version') eq $Sepia::VERSION);
43 ok(Sepia::module_info('Sepia', 'file') =~ /Sepia\.pm$/);
44 ok(Sepia::module_info('Sepia', 'is_core') == 0);
45 my @mu = sort(Sepia::module_info('Sepia', 'modules_used'));
46 my @mu_exp = qw(B Cwd Exporter Module::Info strict);
47 ok(1 || all(map { $mu[$_] eq $mu_exp[$_] } 0..$#mu), "@mu");
48 ok((Sepia::module_info('Sepia', 'packages_inside'))[0] eq 'Sepia');
49 ok((Sepia::module_info('Sepia', 'superclasses'))[0] eq 'Exporter');
50 # 18 to here
52 exit;