Debian Codegraph @

cmd/go-yaml/testdata/key-ordering.yaml

raw symbols SCIP
1 # Key ordering tests for -n and -N flags
2 # These tests verify that keys appear in the correct order:
3 # For -n: anchor, tag, head, line, foot, then content (mapping/sequence/scalar)
4 # For -N: kind, style, anchor, tag, head, line, foot, then text/content
5
6 - name: Scalar with tag and anchor
7 text: |
8 &myanchor !!str value
9 node: |
10 anchor: myanchor
11 plain: value
12 NODE: |
13 kind: Document
14 content:
15 - kind: Scalar
16 style: Plain
17 anchor: myanchor
18 tag: '!!str'
19 text: value
20
21 - name: Scalar with anchor and comments
22 text: |
23 # head comment
24 &myanchor value # line comment
25 # foot comment
26 node: |
27 anchor: myanchor
28 head: '# head comment'
29 line: '# line comment'
30 foot: '# foot comment'
31 plain: value
32 NODE: |
33 kind: Document
34 content:
35 - kind: Scalar
36 style: Plain
37 anchor: myanchor
38 tag: '!!str'
39 head: '# head comment'
40 line: '# line comment'
41 foot: '# foot comment'
42 text: value
43
44 - name: Mapping with tag, anchor, and comments
45 text: |
46 # head comment
47 &myanchor !!map
48 key: value # line comment
49 # foot comment
50 node: |
51 anchor: myanchor
52 tag: '!!map'
53 mapping:
54 - head: '# head comment'
55 foot: '# foot comment'
56 plain: key
57 - line: '# line comment'
58 plain: value
59 NODE: |
60 kind: Document
61 content:
62 - kind: Mapping
63 style: Plain
64 anchor: myanchor
65 tag: '!!map'
66 content:
67 - kind: Scalar
68 style: Plain
69 tag: '!!str'
70 head: '# head comment'
71 foot: '# foot comment'
72 text: key
73 - kind: Scalar
74 style: Plain
75 tag: '!!str'
76 line: '# line comment'
77 text: value
78
79 - name: Sequence with tag and anchor
80 text: |
81 &myseq !!seq
82 - item1
83 - item2
84 node: |
85 anchor: myseq
86 tag: '!!seq'
87 sequence:
88 - plain: item1
89 - plain: item2
90 NODE: |
91 kind: Document
92 content:
93 - kind: Sequence
94 style: Plain
95 anchor: myseq
96 tag: '!!seq'
97 content:
98 - kind: Scalar
99 style: Plain
100 tag: '!!str'
101 text: item1
102 - kind: Scalar
103 style: Plain
104 tag: '!!str'
105 text: item2
106
107 - name: Sequence with all metadata fields
108 text: |
109 # head comment
110 &myseq !!seq
111 - item1
112 - item2
113 # foot comment
114 node: |
115 anchor: myseq
116 tag: '!!seq'
117 sequence:
118 - head: '# head comment'
119 plain: item1
120 - foot: '# foot comment'
121 plain: item2
122 NODE: |
123 kind: Document
124 content:
125 - kind: Sequence
126 style: Plain
127 anchor: myseq
128 tag: '!!seq'
129 content:
130 - kind: Scalar
131 style: Plain
132 tag: '!!str'
133 head: '# head comment'
134 text: item1
135 - kind: Scalar
136 style: Plain
137 tag: '!!str'
138 foot: '# foot comment'
139 text: item2
140
141 - name: Tag comes before anchor
142 text: |
143 &anchor !!str tagged
144 node: |
145 anchor: anchor
146 plain: tagged
147 NODE: |
148 kind: Document
149 content:
150 - kind: Scalar
151 style: Plain
152 anchor: anchor
153 tag: '!!str'
154 text: tagged
155
156 - name: Comments come before content
157 text: |
158 # head
159 key: value # line
160 node: |
161 mapping:
162 - head: '# head'
163 plain: key
164 - line: '# line'
165 plain: value
166 NODE: |
167 kind: Document
168 content:
169 - kind: Mapping
170 style: Plain
171 tag: '!!map'
172 content:
173 - kind: Scalar
174 style: Plain
175 tag: '!!str'
176 head: '# head'
177 text: key
178 - kind: Scalar
179 style: Plain
180 tag: '!!str'
181 line: '# line'
182 text: value
183
184 - name: Double quoted scalar with tag and anchor
185 text: |
186 &myanchor !!str "quoted"
187 node: |
188 anchor: myanchor
189 double: quoted
190 NODE: |
191 kind: Document
192 content:
193 - kind: Scalar
194 style: Double
195 anchor: myanchor
196 tag: '!!str'
197 text: quoted
198
199 - name: Nested mapping with ordered keys
200 text: |
201 &outer !!map
202 # outer head
203 nested:
204 &inner !!map
205 # inner head
206 key: value
207 node: |
208 anchor: outer
209 tag: '!!map'
210 mapping:
211 - head: '# outer head'
212 plain: nested
213 - anchor: inner
214 tag: '!!map'
215 mapping:
216 - head: '# inner head'
217 plain: key
218 - plain: value
219 NODE: |
220 kind: Document
221 content:
222 - kind: Mapping
223 style: Plain
224 anchor: outer
225 tag: '!!map'
226 content:
227 - kind: Scalar
228 style: Plain
229 tag: '!!str'
230 head: '# outer head'
231 text: nested
232 - kind: Mapping
233 style: Plain
234 anchor: inner
235 tag: '!!map'
236 content:
237 - kind: Scalar
238 style: Plain
239 tag: '!!str'
240 head: '# inner head'
241 text: key
242 - kind: Scalar
243 style: Plain
244 tag: '!!str'
245 text: value