File: alien_build_plugin_core_cleaninstall.t

package info (click to toggle)
libalien-build-perl 2.84-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,116 kB
  • sloc: perl: 10,350; ansic: 134; sh: 66; makefile: 2
file content (72 lines) | stat: -rw-r--r-- 1,641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use 5.008004;
use Test2::V0 -no_srand => 1;
use Alien::Build::Plugin::Core::CleanInstall;
use Test::Alien::Build;
use Path::Tiny qw( path );

subtest 'basic' => sub {

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'share' };
  };

  my $dir = path($build->runtime_prop->{prefix});

  $dir->child($_)->mkpath for qw( _alien bin include lib );
  $dir->child('foo.txt')->touch;
  $dir->child('_alien/alienfile')->touch;
  $dir->child('bin/myexe')->touch;
  $dir->child('include/myheader.h')->touch;
  $dir->child('lib/libfoo.a')->touch;

  alien_clean_install;

  ok  -d "$dir/_alien";
  ok  -f "$dir/_alien/alienfile";
  ok !-e "$dir/foo.txt";
  ok !-e "$dir/bin/myexe";
  ok !-e "$dir/include/myheader.h";
  ok !-e "$dir/lib/libfoo.a";
};

subtest 'do not remove on system install' => sub {

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'system' };
  };

  my $dir = path($build->runtime_prop->{prefix});

  $dir->child($_)->mkpath for qw( _alien bin include lib );
  $dir->child('foo.txt')->touch;
  $dir->child('_alien/alienfile')->touch;
  $dir->child('bin/myexe')->touch;
  $dir->child('include/myheader.h')->touch;
  $dir->child('lib/libfoo.a')->touch;

  alien_clean_install;

  ok  -d "$dir/_alien";
  ok  -f "$dir/_alien/alienfile";
  ok  -f "$dir/foo.txt";
  ok  -f "$dir/bin/myexe";
  ok  -f "$dir/include/myheader.h";
  ok  -f "$dir/lib/libfoo.a";
};

subtest 'do not try to remove when it isn\'t there' => sub {

  my $build = alienfile_ok q{
    use alienfile;
    probe sub { 'share' };
  };

  path($build->runtime_prop->{prefix})->remove_tree;

  alien_clean_install;

};

done_testing;