-
Notifications
You must be signed in to change notification settings - Fork 8
/
13_flate_structured.t
100 lines (75 loc) · 2.33 KB
/
13_flate_structured.t
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/perl
use strict;
use warnings;
our $test_class = 'TypeTest::Structured';
our @fields = (
# TUPLES #
'tuple' => [
'tuple', [ 'foo', 2 ], { 0 => 'foo', 1 => 2 } #
],
'tuple_optional' => [
'tuple_optional_2', [ 'foo', 2 ], { 0 => 'foo', 1 => 2 }, #
'tuple_optional_1', ['foo'], { 0 => 'foo' } #
],
'tuple_empty' => [
'tuple_empty', [], [] #
],
'tuple_blank' => [
'tuple_blank', [ \1 ], [ \1 ] #
],
'tuple_bad' => qr/No ..flator found for key/,
# DICTS #
'dict' => [
'dict', { str => 'Foo', int => 5 }, { str => 'Foo', int => 5 } #
],
'dict_optional' => [
'dict_optional_2', { str => 'Foo', int => 5 },
{ str => 'Foo', int => 5 }, #
'dict_optional_1', { int => 5 }, { int => 5 } #
],
'dict_empty' => [ 'dict_empty', {}, {} ],
'dict_blank' => [ 'dict_blank', { a => \1 }, { a => \1 }, ],
'dict_bad' => qr/No ..flator found for key/,
# MAPS #
'map' => [
'map', { foo => 1, bar => 2 }, { foo => 1, bar => 2 } #
],
'map_blank' =>
[ 'map_blank', { foo => 1, 1 => 'foo' }, { foo => 1, 1 => 'foo' }, ],
'map_empty' =>
[ 'map_empty', { foo => 1, 1 => 'foo' }, { foo => 1, 1 => 'foo' }, ],
'map_bad' => qr/No ..flator found for attribute/,
# OPTIONALS @
'optional' => [
'optional', 123, 123 #
],
'optional_blank' => [
'optional_blank', 123, 123 #
],
'optional_bad' => qr/No ..flator found for attribute/,
# COMBOS #
'combo' => [
'combo_1',
{ str => 'foo',
dict => { int => 1, str => 'bar' },
map => { 5 => 'baz' },
tuple => [ 5, 'baz' ]
},
{ str => 'foo',
dict => { int => 1, str => 'bar' },
map => { 5 => 'baz' },
tuple => { 0 => 5, 1 => 'baz' }
},
'combo_2',
{ str => 'foo',
dict => { int => 1 },
tuple => [5]
},
{ str => 'foo',
dict => { int => 1 },
tuple => { 0 => 5 }
},
]
);
do 't/10_typemaps/test_flation.pl' or die $!;
1;