added lines_from_command util
[scpubgit/System-Introspector.git] / t / libdirs-perl.t
CommitLineData
b112c9f3 1use strictures 1;
2use Test::More;
3use FindBin;
4
5use System::Introspector::LibDirs::Perl;
6
7my $dir = "$FindBin::Bin/data/libdir/perl";
8
9no 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
16my $probe = System::Introspector::LibDirs::Perl->new(
17 root => $dir,
18);
19my $data = $probe->gather;
20
21my $sha = delete $data->{"$dir/lib/perl5"}{Foo}[0]{sha256_hex};
22ok $sha, 'contains SHA fingerprint';
23
24my $size = delete $data->{"$dir/lib/perl5"}{Foo}[0]{size};
25ok $size, 'contains file size';
26
27is_deeply $data, {
28 "$dir/lib/perl5" => {
29 Foo => [
30 { file => "$dir/lib/perl5/Foo.pm", version => 0.001 },
31 ],
32 },
33}, 'package found';
34
35done_testing;