App-DuckPAN
view release on metacpan or search on metacpan
t/template/templates.yml view on Meta::CPAN
input: share/css/default.css
output: t/out/share/css/<:$ia_id:>.css
complex_out_dir:
label: README file
input: share/text/README
output: t/out/share/text/<:$ia_id:>/docs/README
no_input:
label: File with non-existent input
input: share/text/does_not_exist.txt
output: t/out/share/text/<:$ia_id:>.txt
no_write_perm:
label: Output directory is not writeable
input: share/text/README
output: t/out/readonly/<:$ia_id:>.txt
template_sets:
all_optional:
description: Template set with all optional templates
t/template/templates.yml view on Meta::CPAN
errors:
description: Template set with templates that can produce errors
required: [ pm ]
optional: [ no_input ]
subdir_support_specified:
description: Template which will not work if IAs are created inside a subdirectory
required: [ pm ]
subdir_support: false
subdir_support_not_defined:
description: Template which will work if IAs are created inside a subdirectory
required: [ pm ]
...
t/templates.t view on Meta::CPAN
# check template sets
my @template_sets = $template_defs->get_template_sets;
my %template_set_map = map { $_->name => $_ } @template_sets;
# check if template sets are instantiated
isa_ok $_, 'App::DuckPAN::TemplateSet'
for @template_sets;
# check if all the template sets have been read
is_deeply [ sort map { $_->name } @template_sets ],
[qw(all_optional errors required_and_optional subdir_support_not_defined subdir_support_specified)],
'template defs: read all template sets';
###############################
# Template definitions errors #
###############################
throws_ok {
my $templates_defs = App::DuckPAN::TemplateDefinitions->new(
templates_yml => 't/template/templates-nonexistent.yml'
);
t/templates.t view on Meta::CPAN
my $template_set_ro = $template_set_map{required_and_optional};
is $template_set_ro->description, 'Template set with required and optional templates',
'template defs: set template_set description';
is_deeply $template_set_ro->required_templates, [@template_map{qw(pm test)}],
'template defs: set template_set required templates';
is_deeply $template_set_ro->optional_templates, [@template_map{qw(js css)}],
'template defs: set template_set optional templates';
ok !$template_set_map{subdir_support_specified}->subdir_support, 'Template set with subdir support explicitly disabled';
ok $template_set_map{subdir_support_not_defined}->subdir_support, 'Template set with subdir support implicitly enabled';
{
# check template combinations that we should show to the user
my $combinations = $template_set_map{all_optional}->optional_template_combinations;
# for neater code
my %tm = %template_map;
# combinations must be in a particular order
is_deeply $combinations,
( run in 0.393 second using v1.01-cache-2.11-cpan-0d8aa00de5b )