Skip to content

Commit 3b4cb1d

Browse files
committed
tests for circular references.
inflators currently skipped - needs patch to DateTime::Format::Builder
1 parent 73fb25d commit 3b4cb1d

File tree

3 files changed

+183
-0
lines changed

3 files changed

+183
-0
lines changed

MANIFEST.SKIP

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
^benchmarks\b
22
^dojo\b
3+
^examples\b
34
^update_pm_from_templates\.pl$
5+
^client-side-constraint
6+
^t\b.*\.disabled
7+
^t\b.*CatalystApp
48

59
# Eclipse workspace file
610
^\.project$

t/bugs/circular_reference.t

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
use HTML::FormFu;
6+
7+
eval "use Test::Memory::Cycle";
8+
9+
if ($@) {
10+
plan skip_all =>
11+
'Test::Memory::Cycle required for testing circular references';
12+
exit;
13+
}
14+
15+
plan( tests => 2 );
16+
17+
my $form = HTML::FormFu->new;
18+
19+
$form->load_config_file('t/bugs/circular_reference.yml');
20+
21+
memory_cycle_ok($form);
22+
23+
memory_cycle_ok( $form->render );

t/bugs/circular_reference.yml

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
auto_fieldset: 1
3+
4+
elements:
5+
- type: Block
6+
elements:
7+
- type: Text
8+
name: foo
9+
10+
- type: Checkbox
11+
name: checkbox
12+
default: 1
13+
14+
- type: ContentButton
15+
name: contentbutton
16+
content: foo
17+
18+
- type: Date
19+
name:
20+
# auto_inflate: 1
21+
22+
- type: Fieldset
23+
legend: foo
24+
elements:
25+
- name: fs1
26+
- name: fs2
27+
28+
- type: Image
29+
name: image
30+
src: 'image.png'
31+
width: 10
32+
height: 10
33+
34+
- type: Multi
35+
elements:
36+
- name: multi1
37+
- name: multi2
38+
39+
- type: Radiogroup
40+
name: radiogroup
41+
values: [yes, no]
42+
constraints:
43+
- type: Set
44+
set: [yes, no]
45+
46+
- type: Select
47+
name: select
48+
options:
49+
- [1, one]
50+
- [2, two]
51+
- group:
52+
- value: 2a
53+
label: two-a
54+
- value: 2b
55+
label: two-b
56+
- value: 3
57+
label: three
58+
constraints:
59+
- type: AutoSet
60+
61+
- type: SimpleTable
62+
headers:
63+
- One
64+
- Two
65+
rows:
66+
-
67+
- name: one_a
68+
- name: two_a
69+
-
70+
- name: one_b
71+
- name: two_b
72+
73+
- type: Submit
74+
name: submit
75+
76+
- type: Text
77+
name: text
78+
deflators:
79+
- type: Strftime
80+
strftime: '%d-%m-%Y'
81+
82+
# inflators:
83+
# - type: DateTime
84+
# parser:
85+
# strptime: '%d-%m-%Y'
86+
87+
constraints:
88+
- type: AllOrNone
89+
others: [text2]
90+
91+
- type: DependOn
92+
others: [text2]
93+
94+
- type: Equal
95+
others: [text2]
96+
97+
- type: MinMaxFields
98+
min: 2
99+
max: 2
100+
101+
- type: Text
102+
name: text2
103+
104+
filters:
105+
- type: Encode
106+
candidates: [utf8]
107+
108+
- type: HTMLEscape
109+
110+
- type: HTMLScrubber
111+
112+
- type: LowerCase
113+
114+
- type: NonNumeric
115+
116+
- type: Regex
117+
118+
- type: TrimEdges
119+
120+
- type: UpperCase
121+
122+
- type: Whitespace
123+
124+
constraints:
125+
- type: ASCII
126+
127+
- type: Bool
128+
129+
- type: Email
130+
131+
- type: Integer
132+
133+
- type: Length
134+
min: 3
135+
max: 8
136+
137+
- type: Number
138+
139+
- type: Printable
140+
141+
- type: Range
142+
min: 1
143+
max: 1000
144+
145+
- type: Regex
146+
common:
147+
- URI
148+
- HTTP
149+
- { '-scheme': 'https?' }
150+
151+
- type: Required
152+
153+
- type: SingleValue
154+
155+
- type: Word
156+

0 commit comments

Comments
 (0)