File Coverage

tests/test-framework-1
Criterion Covered Total %
statement 13 41 31.7
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 18 47 38.3


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2              
3             # The script tests Arch::Test::Framework methods.
4              
5 1     1   821 use FindBin;
  1         1209  
  1         90  
6 1     1   804 use lib "$FindBin::Bin/../perllib";
  1         640  
  1         6  
7              
8 1     1   1217 use Test::More;
  1         20350  
  1         11  
9 1     1   1021 use Arch::Util qw(is_tla_functional);
  1         3  
  1         2185  
10              
11 1 50       6 plan skip_all => "No functional arch backend" unless is_tla_functional;
12 0         0 plan tests => 17;
13              
14 0         0 use_ok("Arch::Test::Framework");
15              
16 0         0 my $arch_user = 'Arch Test';
17 0         0 my $arch_uid = 'arch-test@my.place';
18 0         0 my $arch_id = "$arch_user <$arch_uid>";
19              
20 0         0 my $fw = Arch::Test::Framework->new(userid => $arch_id);
21              
22 0         0 isa_ok($fw, 'Arch::Test::Framework', 'environment');
23              
24 0         0 my $home = $fw->home_dir;
25 0         0 my $len = length $home;
26              
27 0         0 ok(-d $home, 'environment home exists');
28 0         0 ok(-d "$home/.arch-params", 'environment has arch-params');
29              
30 0         0 isnt($home, $ENV{HOME}, 'environment home is not user home');
31              
32 0         0 is($fw->arch_uid, $arch_uid, 'arch uid correctly set');
33 0         0 is($fw->run_tla('my-id', '--uid'), $fw->arch_uid, 'arch uid correctly set');
34              
35 0         0 my $local_uid = `tla my-id --uid`;
36 0         0 chomp $local_uid;
37              
38 0         0 isnt($local_uid, $fw->arch_uid, 'correctly uses new home directory');
39              
40 0         0 ok(-d $fw->library_dir, 'library dir exists');
41 0         0 is(substr($fw->library_dir, 0, $len), $home, 'library dir is in home');
42 0         0 ok(-d $fw->archives_dir, 'archives dir exists');
43 0         0 is(substr($fw->archives_dir, 0, $len), $home, 'archives dir is in home');
44 0         0 ok(-d $fw->trees_dir, 'trees dir exists');
45 0         0 is(substr($fw->trees_dir, 0, $len), $home, 'trees dir is in home');
46              
47 0         0 my $ar1 = $fw->make_archive;
48              
49 0         0 isa_ok(
50             $ar1,
51             'Arch::Test::Archive',
52             'make_archive creates Arch::Test::Archive'
53             );
54              
55 0         0 isnt(
56             $fw->run_tla('whereis-archive', $ar1->name),
57             '',
58             'make_archive registers archive'
59             );
60              
61 0         0 my $ar2 = $fw->make_archive;
62 0         0 isnt($ar1->name, $ar2->name, 'make_archive generates unique archive names');