Alien-Build

 view release on metacpan or  search on metacpan

t/alien_build_plugin_core_gather.t  view on Meta::CPAN

    warn $error if $error;
    ();
  };

  is $error, '';

  note _dump $build->install_prop;

  ok( -f $stage->child('_alien/patch/foo.diff') );
};

subtest 'pkg-config path during gather' => sub {

  my $build = alienfile_ok q{
    use alienfile;
    use Path::Tiny qw( path );
    plugin 'Test::Mock',
      probe    => 'share',
      download => 1,
      extract  => 1;
    use Env qw( @PKG_CONFIG_PATH );
    share {
      build    sub {
        my($build) = @_;
        my $prefix = path($build->install_prop->{prefix});
        $build->log("prefix = $prefix");
        $prefix->child('lib/pkgconfig')->mkpath;
        $prefix->child('lib/pkgconfig/x3.pc')->spew("Name: x3\n");
        $prefix->child('share/pkgconfig')->mkpath;
        $prefix->child('share/pkgconfig/x4.pc')->spew("Name: x4\n");
      };
      gather   sub {
        my($build) = @_;
        $build->install_prop->{my_pkg_config_path} = [@PKG_CONFIG_PATH];
      };
    };
  };

  alien_build_ok;

  is(
    $build->install_prop,
    hash {
      field my_pkg_config_path => array {
        item validator(sub {
          return -f "$_/x3.pc";
        });
        item validator(sub {
          return -f "$_/x4.pc";
        });
        end;
      };
      etc;
    },
    'has arch and arch-indy pkg-config paths',
  );


};

subtest '_alien/alien.json should be okay with unicode' => sub {

  my $build = alienfile q{
    use alienfile;
    use utf8;
    probe sub { 'system' };
    gather sub {
      my($build) = @_;
      $build->runtime_prop->{'龍'} = '火';
    };
  };

  alien_build_ok;
  is(
    $build->runtime_prop,
    hash {
      field '龍' => '火';
      etc;
    }
  );

  my $json_file = path($build->install_prop->{prefix}, '_alien', 'alien.json');
  ok -r $json_file;

  require JSON::PP;
  my $config = JSON::PP::decode_json($json_file->slurp);
  is(
    $config,
    hash {
      field '龍' => '火';
      etc;
    }
  );


};

done_testing;



( run in 0.946 second using v1.01-cache-2.11-cpan-62a16548d74 )