File: alien_build_plugin_core_legacy.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 (51 lines) | stat: -rw-r--r-- 1,291 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
use 5.008004;
use Test2::V0 -no_srand => 1;
use Test::Alien::Build;
use Alien::Build::Plugin::Core::Legacy;
use Capture::Tiny qw( capture_merged );
use File::Temp qw( tempdir );

subtest 'basic' => sub {

  my $build = alienfile q{
    use alienfile;
    plugin 'Test::Mock',
      probe    => 'share',
      download => 1,
      extract  => 1,
      build    => 1,
    share {
      gather sub {
        my($build) = @_;
        $build->runtime_prop->{cflags}  = '-DFOO=1';
        $build->runtime_prop->{libs}    = '-lfoo';
        $build->runtime_prop->{version} = '1.2.3';
      };
    };
  };

  capture_merged {
    $build->probe;
    $build->download;
    $build->build;
  };

  is( $build->runtime_prop->{cflags},        '-DFOO=1', 'cflags'        );
  is( $build->runtime_prop->{libs},          '-lfoo',   'libs'          );
  is( $build->runtime_prop->{cflags_static}, '-DFOO=1', 'cflags_static' );
  is( $build->runtime_prop->{libs_static},   '-lfoo',   'libs_static'   );

  is(
    $build->runtime_prop->{legacy},
    hash {
      field 'finished_installing' => T();
      field 'install_type'        => 'share';
      field 'version'             => '1.2.3';
      field 'original_prefix'     => $build->runtime_prop->{prefix};
    },
    'legacy hash',
  );

};

done_testing;