Debian Codegraph @

cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/collection.tml

raw
1 #--------------------------------------------------------------------------#
2 # This file is for testing combinations of sequences and mappings
3 #--------------------------------------------------------------------------#
4
5 #####################################################################
6 # Null HASH/ARRAY
7
8 === null hash in array
9 --- yaml
10 ---
11 - foo
12 - {}
13 - bar
14 --- perl
15 [ [ 'foo', {}, 'bar' ] ]
16
17
18 === null array in array
19 --- yaml
20 ---
21 - foo
22 - []
23 - bar
24 --- perl
25 [ [ 'foo', [], 'bar' ] ]
26
27
28 === null hash in hash
29 --- yaml
30 ---
31 foo: {}
32 bar: 1
33 --- perl
34 [ { foo => {}, bar => 1 } ]
35
36
37 === null array in hash
38 --- yaml
39 ---
40 foo: []
41 bar: 1
42 --- perl
43 [ { foo => [], bar => 1 } ]
44
45 # Simple array inside a hash with an undef
46 === array_in_hash
47 --- yaml
48 ---
49 foo:
50 - bar
51 - ~
52 - baz
53
54 --- perl
55 [ { foo => [ 'bar', undef, 'baz' ] } ]
56
57
58 # Simple hash inside a hash with an undef
59 === hash_in_hash
60 --- yaml
61 ---
62 foo: ~
63 bar:
64 foo: bar
65
66 --- perl
67 [ { foo => undef, bar => { foo => 'bar' } } ]
68
69
70 # Mixed hash and scalars inside an array
71 === hash_in_array
72 --- yaml
73 ---
74 -
75 foo: ~
76 this: that
77 - foo
78 - ~
79 -
80 foo: bar
81 this: that
82
83 --- perl
84 [ [
85 { foo => undef, this => 'that' },
86 'foo',
87 undef,
88 { foo => 'bar', this => 'that' },
89 ] ]
90
91
92 ######################################################################
93 # Non-Indenting Sub-List
94
95 === Non-indenting sub-list
96 --- yaml
97 ---
98 foo:
99 - list
100 bar: value
101 --- perl
102 [ { foo => [ 'list' ], bar => 'value' } ]
103 --- noyamlpm
104
105
106
107 # Inline nested hash
108 === inline_nested_hash
109 --- yaml
110 ---
111 - ~
112 - foo: bar
113 this: that
114 - baz
115
116 --- perl
117 [ [ undef, { foo => 'bar', this => 'that' }, 'baz' ] ]
118
119
120 # RT 51491
121 === space after hypen
122 --- yaml
123 \---
124 FOO:
125 -
126 bar: baz
127 --- perl
128 [ { 'FOO' => [ { bar => 'baz' } ] } ]
129
130 # RT 92916 (a Test::Database ticket)
131 === colon at end of key
132 --- yaml
133 \---
134 dbi:SQLite::
135 foo: bar
136 --- perl
137 [ { 'dbi:SQLite:' => { 'foo' => 'bar' } } ]