File: static_install.t

package info (click to toggle)
libdist-zilla-plugin-modulebuildtiny-perl 0.015-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 132 kB
  • ctags: 6
  • sloc: perl: 204; makefile: 2
file content (65 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;

use Test::More;
use Test::DZil;
use Test::Deep;
use Path::Tiny;

my @tests = (
	{
		test_name => '.PL file present',
		zilla_files => [
			path(qw(source lib Foo.PL)) => qq{#!/usr/bin/perl\nexit 0;\n},
		],
		x_static_install => 0,
	},
	{
		test_name => '.xs file present',
		zilla_files => [
			path(qw(source lib Foo.xs)) => qq{#include "perl.h"\n},
		],
		x_static_install => 0,
	},
	{
		test_name => 'static install',
		x_static_install => 1,
	},

);

subtest $_->{test_name} => sub
{
	my $config = $_;

	my $tzil = Builder->from_config(
		{ dist_root => 't/does_not_exist' },
		{
			add_files => {
				'source/dist.ini' => simple_ini(
					[ ModuleBuildTiny => {
							static => 'auto',
						}
					],
					'MetaJSON',
				),
				path(qw(source lib Foo.pm)) => "package Foo;\n1;\n",
				@{ $config->{zilla_files} || [] },
			},
		},
	);
	$tzil->build;

	cmp_deeply(
		$tzil->distmeta,
		superhashof({
			x_static_install => 1,
		}),
		"metadata contains auto-computed value for x_static_install($config->{x_static_install})",
	) or diag 'got distmeta: ', explain $tzil->distmeta;
}
foreach @tests;

done_testing;

# vim: set sts=4 ts=4 sw=4 noet nolist :