Debian Codegraph @

t/form_setup/include.t

raw
1 use strict;
2 use warnings;
3 use Test::More;
4
5 # Test using the 'include' attribute for building fields
6 # to skip the build overhead for unused fields.
7 {
8 package Test::Form::Fields;
9 use HTML::FormHandler::Moose::Role;
10
11 has_field 'foo';
12 has_field 'bar';
13 has_field 'ark';
14 has_field 'cat';
15 has_field 'dog';
16 has_field 'ewe';
17 }
18
19 {
20 package Test::Form;
21 use HTML::FormHandler::Moose;
22 extends 'HTML::FormHandler';
23 with 'Test::Form::Fields';
24
25 sub build_include { ['foo', 'ark', 'dog', 'ewe' ] }
26 }
27
28 my $form = Test::Form->new;
29 is( $form->num_fields, 4, 'right number of fields' );
30
31 done_testing;