Commit | Line | Data |
b112c9f3 |
1 | use strictures 1; |
2 | use Test::More; |
3 | use FindBin; |
4 | |
5 | use System::Introspector::LibDirs::Perl; |
6 | |
7 | my $dir = "$FindBin::Bin/data/libdir/perl"; |
8 | |
9 | no warnings 'redefine'; |
10 | *System::Introspector::LibDirs::Perl::_open_locate_libdirs_pipe = sub { |
11 | my $output = "$dir/lib/perl5\n"; |
12 | open my $fh, '<', \$output; |
13 | return $fh; |
14 | }; |
15 | |
16 | my $probe = System::Introspector::LibDirs::Perl->new( |
17 | root => $dir, |
18 | ); |
19 | my $data = $probe->gather; |
20 | |
21 | my $sha = delete $data->{"$dir/lib/perl5"}{Foo}[0]{sha256_hex}; |
22 | ok $sha, 'contains SHA fingerprint'; |
23 | |
24 | my $size = delete $data->{"$dir/lib/perl5"}{Foo}[0]{size}; |
25 | ok $size, 'contains file size'; |
26 | |
27 | is_deeply $data, { |
28 | "$dir/lib/perl5" => { |
29 | Foo => [ |
30 | { file => "$dir/lib/perl5/Foo.pm", version => 0.001 }, |
31 | ], |
32 | }, |
33 | }, 'package found'; |
34 | |
35 | done_testing; |