capture origin/<name> of active branch in case remote is not tracked
[scpubgit/System-Introspector.git] / t / libdirs-perl.t
CommitLineData
b112c9f3 1use strictures 1;
2use Test::More;
3use FindBin;
4
afd7c030 5use System::Introspector::Probe::LibDirs::Perl;
b112c9f3 6
7my $dir = "$FindBin::Bin/data/libdir/perl";
8
9no warnings 'redefine';
afd7c030 10*System::Introspector::Probe::LibDirs::Perl::_open_locate_libdirs_pipe = sub {
b112c9f3 11 my $output = "$dir/lib/perl5\n";
12 open my $fh, '<', \$output;
13 return $fh;
14};
15
afd7c030 16my $probe = System::Introspector::Probe::LibDirs::Perl->new(
b112c9f3 17 root => $dir,
18);
19my $data = $probe->gather;
20
ff854047 21my $sha = delete $data
22 ->{libdirs_perl}{"$dir/lib/perl5"}{modules}{Foo}[0]{sha256_hex};
b112c9f3 23ok $sha, 'contains SHA fingerprint';
24
ff854047 25my $size = delete $data
26 ->{libdirs_perl}{"$dir/lib/perl5"}{modules}{Foo}[0]{size};
b112c9f3 27ok $size, 'contains file size';
28
29is_deeply $data, {
ff854047 30 libdirs_perl => {
31 "$dir/lib/perl5" => {
32 modules => {
33 Foo => [
34 { file => "$dir/lib/perl5/Foo.pm", version => 0.001 },
35 ],
36 },
37 },
b112c9f3 38 },
39}, 'package found';
40
41done_testing;