File Coverage

tests/tree-2
Criterion Covered Total %
statement 16 18 88.8
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 23 26 88.4


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2              
3             # The script tests Arch::Tree methods.
4              
5 1     1   7 use strict;
  1         1  
  1         38  
6              
7 1     1   865 use FindBin;
  1         1188  
  1         89  
8 1     1   864 use lib "$FindBin::Bin/../perllib";
  1         658  
  1         8  
9              
10 1     1   1306 use Test::More;
  1         46455  
  1         12  
11 1     1   1033 use Arch::Util qw(is_tla_functional);
  1         3  
  1         113  
12              
13             BEGIN {
14 1 50   1   6 plan skip_all => "No functional arch backend" unless is_tla_functional;
15 0           plan tests => 5;
16              
17             # import constants at compile time
18 0           use_ok("Arch::Inventory", qw(:category :type));
19             }
20              
21             use_ok("Arch::Tree");
22              
23             my $expected_entry_path = 'perllib/Arch/Tree.pm';
24             my $expected_entry = {
25             category => SOURCE,
26             untagged => '',
27             type => FILE,
28             path => $expected_entry_path,
29             id => 'x_Mikhael_Goikhman__Thu_Aug_26_16:34:45_2004_18965.1',
30             id_type => 'x',
31             };
32              
33             SKIP: {
34             my $tree = eval { Arch::Tree->new("$FindBin::Bin/..") };
35             skip("not in arch tree ($FindBin::Bin/..)", 3) if $@;
36              
37             # get_inventory
38             my $inventory = $tree->get_inventory();
39             ok($inventory, "got inventory");
40              
41             my $entry = $inventory->get_entry($expected_entry_path);
42             ok($entry, "inventory contains Arch/Tree.pm");
43             ok(eq_hash($entry, $expected_entry), "inventory entry is valid");
44             }