File Coverage

tests/name-1
Criterion Covered Total %
statement 47 47 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 52 52 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2              
3             # The script tests Arch::Name methods.
4              
5 1     1   7 use strict;
  1         2  
  1         42  
6              
7 1     1   775 use FindBin;
  1         1647  
  1         49  
8 1     1   704 use lib "$FindBin::Bin/../perllib";
  1         588  
  1         6  
9              
10 1     1   1056 use Test::More tests => 21;
  1         18367  
  1         10  
11 1     1   7 use_ok("Arch::Name");
  1         817  
  1         2  
  1         2  
  1         12  
12              
13 1         835 my $tree_version = 'migo@homemail.com--Perl-GPL/arch-perl--devel--0';
14 1         15 my @tree_version_items = split('--(?!P)|/', $tree_version);
15 1         5 my $tree_version_nan = join('--', @tree_version_items[1 .. 3]);
16              
17 1         6 my $name = Arch::Name->new($tree_version);
18 1         6 isa_ok($name, 'Arch::Name', "create object");
19 1         664 is($tree_version, $name->to_string, "to_string");
20 1         574 is($tree_version, $name->fqn, "fqn");
21 1         509 is($tree_version_nan, $name->to_nonarch_string, "to_nonarch_string");
22 1         511 is($tree_version_nan, $name->nan, "nan");
23 1         437 my @array = $name->to_array;
24 1         7 ok(eq_array(\@array, \@tree_version_items), "to_array");
25 1         683 ok(eq_array([ $name->get ], \@array), "get");
26 1         582 my %hash = $name->to_hash;
27 1         8 ok(eq_set([ values %hash ], \@tree_version_items), "to_hash");
28 1         639 is($name->archive, $tree_version_items[0], "archive");
29 1         456 is($name->category, $tree_version_items[1], "category");
30 1         425 is($name->branch, $tree_version_items[2], "branch");
31 1         462 is($name->version, $tree_version_items[3], "version");
32 1         465 is($name->revision, $tree_version_items[4], "revision");
33              
34 1         565 my ($archive, $category, $branch, $version, $revision);
35 1         7 $version = $name->clone;
36 1         5 isa_ok($version, "Arch::Name", "clone");
37 1         610 is($version->to_string, $tree_version, "clone to_string");
38 1         544 $branch = $version->parent;
39 1         5 $archive = $version->parent(3);
40 1         5 is($archive->error, undef, "error");
41 1         422 ok($branch->fqn =~ $archive->fqn . "/.+--", "parents");
42 1         448 ok(eq_hash(scalar $branch->parent(2)->to_hash, { $archive->to_hash }), "hash");
43 1         6503 is($branch->level, 3, "level num");
44 1         557 is($branch->level(1), "branch", "level name");