File: alien_build_rc__prepostload_plugin.t

package info (click to toggle)
libalien-build-perl 2.84-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,116 kB
  • sloc: perl: 10,350; ansic: 134; sh: 66; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 651 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
use 5.008004;
use Test2::V0 -no_srand => 1;
use Test::Alien::Build;

{
  package Alien::Build::Plugin::Foo::Foo;
  use Alien::Build::Plugin;
  has arg => -1;
  sub init {
    my($self, $meta) = @_;
    push @{ $meta->prop->{test} }, $self->arg;
  };
}

subtest 'basic' => sub {

  alien_rc q{
    preload_plugin 'Foo::Foo', arg => 10;
    postload_plugin 'Foo::Foo', arg => 12;
  };

  my $build = alienfile_ok q{
    use alienfile;
    plugin 'Foo::Foo', arg => 11;
  };

  is(
    $build,
    object {
      call meta_prop => hash {
        field test => [ 10,11,12 ];
        etc;
      };
    },
    'loaded in correct order');

};

done_testing;