summaryrefslogtreecommitdiffstats
path: root/third_party/rust/yaml-rust/tests/specexamples.rs.inc
blob: a5398c3ab1ad5f661d6c424688b8d0562c64478b (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
const EX2_1 : &'static str =
    "- Mark McGwire\n- Sammy Sosa\n- Ken Griffey";

const EX2_2 : &'static str =
    "hr:  65    # Home runs\navg: 0.278 # Batting average\nrbi: 147   # Runs Batted In";

const EX2_3 : &'static str =
    "american:\n- Boston Red Sox\n- Detroit Tigers\n- New York Yankees\nnational:\n- New York Mets\n- Chicago Cubs\n- Atlanta Braves";

const EX2_4 : &'static str =
    "-\n  name: Mark McGwire\n  hr:   65\n  avg:  0.278\n-\n  name: Sammy Sosa\n  hr:   63\n  avg:  0.288";

const EX2_5 : &'static str =
    "- [name        , hr, avg  ]\n- [Mark McGwire, 65, 0.278]\n- [Sammy Sosa  , 63, 0.288]";

const EX2_6 : &'static str =
    "Mark McGwire: {hr: 65, avg: 0.278}\nSammy Sosa: {\n    hr: 63,\n    avg: 0.288\n  }";

const EX2_7 : &'static str =
    "# Ranking of 1998 home runs\n---\n- Mark McGwire\n- Sammy Sosa\n- Ken Griffey\n\n# Team ranking\n---\n- Chicago Cubs\n- St Louis Cardinals";

const EX2_8 : &'static str =
    "---\ntime: 20:03:20\nplayer: Sammy Sosa\naction: strike (miss)\n...\n---\ntime: 20:03:47\nplayer: Sammy Sosa\naction: grand slam\n...";

const EX2_9 : &'static str =
    "---\nhr: # 1998 hr ranking\n  - Mark McGwire\n  - Sammy Sosa\nrbi:\n  # 1998 rbi ranking\n  - Sammy Sosa\n  - Ken Griffey";

const EX2_10 : &'static str =
    "---\nhr:\n  - Mark McGwire\n  # Following node labeled SS\n  - &SS Sammy Sosa\nrbi:\n  - *SS # Subsequent occurrence\n  - Ken Griffey";

const EX2_11 : &'static str =
    "? - Detroit Tigers\n  - Chicago cubs\n:\n  - 2001-07-23\n\n? [ New York Yankees,\n    Atlanta Braves ]\n: [ 2001-07-02, 2001-08-12,\n    2001-08-14 ]";

const EX2_12 : &'static str =
    "---\n# Products purchased\n- item    : Super Hoop\n  quantity: 1\n- item    : Basketball\n  quantity: 4\n- item    : Big Shoes\n  quantity: 1";

const EX2_13 : &'static str =
    "# ASCII Art\n--- |\n  \\//||\\/||\n  // ||  ||__";

const EX2_14 : &'static str =
    "--- >\n  Mark McGwire's\n  year was crippled\n  by a knee injury.";

const EX2_15 : &'static str =
    ">\n Sammy Sosa completed another\n fine season with great stats.\n \n   63 Home Runs\n   0.288 Batting Average\n \n What a year!";

const EX2_16 : &'static str =
    "name: Mark McGwire\naccomplishment: >\n  Mark set a major league\n  home run record in 1998.\nstats: |\n  65 Home Runs\n  0.278 Batting Average\n";

const EX2_17 : &'static str =
    "unicode: \"Sosa did fine.\\u263A\"\ncontrol: \"\\b1998\\t1999\\t2000\\n\"\nhex esc: \"\\x0d\\x0a is \\r\\n\"\n\nsingle: '\"Howdy!\" he cried.'\nquoted: ' # Not a ''comment''.'\ntie-fighter: '|\\-*-/|'";

const EX2_18 : &'static str =
    "plain:\n  This unquoted scalar\n  spans many lines.\n\nquoted: \"So does this\n  quoted scalar.\\n\"";

// TODO: 2.19 - 2.22 schema tags

const EX2_23 : &'static str =
    "---\nnot-date: !!str 2002-04-28\n\npicture: !!binary |\n R0lGODlhDAAMAIQAAP//9/X\n 17unp5WZmZgAAAOfn515eXv\n Pz7Y6OjuDg4J+fn5OTk6enp\n 56enmleECcgggoBADs=\n\napplication specific tag: !something |\n The semantics of the tag\n above may be different for\n different documents.";

const EX2_24 : &'static str =
    "%TAG ! tag:clarkevans.com,2002:\n--- !shape\n  # Use the ! handle for presenting\n  # tag:clarkevans.com,2002:circle\n- !circle\n  center: &ORIGIN {x: 73, y: 129}\n  radius: 7\n- !line\n  start: *ORIGIN\n  finish: { x: 89, y: 102 }\n- !label\n  start: *ORIGIN\n  color: 0xFFEEBB\n  text: Pretty vector drawing.";

const EX2_25 : &'static str =
    "# Sets are represented as a\n# Mapping where each key is\n# associated with a null value\n--- !!set\n? Mark McGwire\n? Sammy Sosa\n? Ken Griffey";

const EX2_26 : &'static str =
    "# Ordered maps are represented as\n# A sequence of mappings, with\n# each mapping having one key\n--- !!omap\n- Mark McGwire: 65\n- Sammy Sosa: 63\n- Ken Griffey: 58";

const EX2_27 : &'static str =
    "--- !<tag:clarkevans.com,2002:invoice>\ninvoice: 34843\ndate   : 2001-01-23\nbill-to: &id001\n    given  : Chris\n    family : Dumars\n    address:\n        lines: |\n            458 Walkman Dr.\n            Suite #292\n        city    : Royal Oak\n        state   : MI\n        postal  : 48046\nship-to: *id001\nproduct:\n    - sku         : BL394D\n      quantity    : 4\n      description : Basketball\n      price       : 450.00\n    - sku         : BL4438H\n      quantity    : 1\n      description : Super Hoop\n      price       : 2392.00\ntax  : 251.42\ntotal: 4443.52\ncomments:\n    Late afternoon is best.\n    Backup contact is Nancy\n    Billsmer @ 338-4338.";

const EX2_28 : &'static str =
    "---\nTime: 2001-11-23 15:01:42 -5\nUser: ed\nWarning:\n  This is an error message\n  for the log file\n---\nTime: 2001-11-23 15:02:31 -5\nUser: ed\nWarning:\n  A slightly different error\n  message.\n---\nDate: 2001-11-23 15:03:17 -5\nUser: ed\nFatal:\n  Unknown variable \"bar\"\nStack:\n  - file: TopClass.py\n    line: 23\n    code: |\n      x = MoreObject(\"345\\n\")\n  - file: MoreClass.py\n    line: 58\n    code: |-\n      foo = bar";

// TODO: 5.1 - 5.2 BOM

const EX5_3 : &'static str =
    "sequence:\n- one\n- two\nmapping:\n  ? sky\n  : blue\n  sea : green";

const EX5_4 : &'static str =
    "sequence: [ one, two, ]\nmapping: { sky: blue, sea: green }";

const EX5_5 : &'static str = "# Comment only.";

const EX5_6 : &'static str =
    "anchored: !local &anchor value\nalias: *anchor";

const EX5_7 : &'static str =
    "literal: |\n  some\n  text\nfolded: >\n  some\n  text\n";

const EX5_8 : &'static str =
    "single: 'text'\ndouble: \"text\"";

// TODO: 5.9 directive
// TODO: 5.10 reserved indicator

const EX5_11 : &'static str =
    "|\n  Line break (no glyph)\n  Line break (glyphed)\n";

const EX5_12 : &'static str =
    "# Tabs and spaces\nquoted: \"Quoted\t\"\nblock:	|\n  void main() {\n  \tprintf(\"Hello, world!\\n\");\n  }";

const EX5_13 : &'static str =
    "\"Fun with \\\\\n\\\" \\a \\b \\e \\f \\\n\\n \\r \\t \\v \\0 \\\n\\  \\_ \\N \\L \\P \\\n\\x41 \\u0041 \\U00000041\"";

const EX5_14 : &'static str =
    "Bad escapes:\n  \"\\c\n  \\xq-\"";

const EX6_1 : &'static str =
    "  # Leading comment line spaces are\n   # neither content nor indentation.\n    \nNot indented:\n By one space: |\n    By four\n      spaces\n Flow style: [    # Leading spaces\n   By two,        # in flow style\n  Also by two,    # are neither\n  \tStill by two   # content nor\n    ]             # indentation.";

const EX6_2 : &'static str =
    "? a\n: -\tb\n  -  -\tc\n     - d";

const EX6_3 : &'static str =
    "- foo:\t bar\n- - baz\n  -\tbaz";

const EX6_4 : &'static str =
    "plain: text\n  lines\nquoted: \"text\n  \tlines\"\nblock: |\n  text\n   \tlines\n";

const EX6_5 : &'static str =
    "Folding:\n  \"Empty line\n   \t\n  as a line feed\"\nChomping: |\n  Clipped empty lines\n ";

const EX6_6 : &'static str =
    ">-\n  trimmed\n  \n \n\n  as\n  space";

const EX6_7 : &'static str =
    ">\n  foo \n \n  \t bar\n\n  baz\n";

const EX6_8 : &'static str =
    "\"\n  foo \n \n  \t bar\n\n  baz\n\"";

const EX6_9 : &'static str =
    "key:    # Comment\n  value";

const EX6_10 : &'static str =
    "  # Comment\n   \n\n";

const EX6_11 : &'static str =
    "key:    # Comment\n        # lines\n  value\n\n";

const EX6_12 : &'static str =
    "{ first: Sammy, last: Sosa }:\n# Statistics:\n  hr:  # Home runs\n     65\n  avg: # Average\n   0.278";

const EX6_13 : &'static str =
    "%FOO  bar baz # Should be ignored\n               # with a warning.\n--- \"foo\"";

const EX6_14 : &'static str =
    "%YAML 1.3 # Attempt parsing\n           # with a warning\n---\n\"foo\"";

const EX6_15 : &'static str =
    "%YAML 1.2\n%YAML 1.1\nfoo";

const EX6_16 : &'static str =
    "%TAG !yaml! tag:yaml.org,2002:\n---\n!yaml!str \"foo\"";

const EX6_17 : &'static str =
    "%TAG ! !foo\n%TAG ! !foo\nbar";

const EX6_18 : &'static str =
    "# Private\n!foo \"bar\"\n...\n# Global\n%TAG ! tag:example.com,2000:app/\n---\n!foo \"bar\"";

const EX6_19 : &'static str =
    "%TAG !! tag:example.com,2000:app/\n---\n!!int 1 - 3 # Interval, not integer";

const EX6_20 : &'static str =
    "%TAG !e! tag:example.com,2000:app/\n---\n!e!foo \"bar\"";

const EX6_21 : &'static str =
    "%TAG !m! !my-\n--- # Bulb here\n!m!light fluorescent\n...\n%TAG !m! !my-\n--- # Color here\n!m!light green";

const EX6_22 : &'static str =
    "%TAG !e! tag:example.com,2000:app/\n---\n- !e!foo \"bar\"";

const EX6_23 : &'static str =
    "!!str &a1 \"foo\":\n  !!str bar\n&a2 baz : *a1";

const EX6_24 : &'static str =
    "!<tag:yaml.org,2002:str> foo :\n  !<!bar> baz";

const EX6_25 : &'static str =
    "- !<!> foo\n- !<$:?> bar\n";

const EX6_26 : &'static str =
    "%TAG !e! tag:example.com,2000:app/\n---\n- !local foo\n- !!str bar\n- !e!tag%21 baz\n";

const EX6_27a : &'static str =
    "%TAG !e! tag:example,2000:app/\n---\n- !e! foo";

const EX6_27b : &'static str =
    "%TAG !e! tag:example,2000:app/\n---\n- !h!bar baz";

const EX6_28 : &'static str =
    "# Assuming conventional resolution:\n- \"12\"\n- 12\n- ! 12";

const EX6_29 : &'static str =
    "First occurrence: &anchor Value\nSecond occurrence: *anchor";

const EX7_1 : &'static str =
    "First occurrence: &anchor Foo\nSecond occurrence: *anchor\nOverride anchor: &anchor Bar\nReuse anchor: *anchor";

const EX7_2 : &'static str =
    "{\n  foo : !!str,\n  !!str : bar,\n}";

const EX7_3 : &'static str =
    "{\n  ? foo :,\n  : bar,\n}\n";

const EX7_4 : &'static str =
    "\"implicit block key\" : [\n  \"implicit flow key\" : value,\n ]";

const EX7_5 : &'static str =
    "\"folded \nto a space,\t\n \nto a line feed, or \t\\\n \\ \tnon-content\"";

const EX7_6 : &'static str =
    "\" 1st non-empty\n\n 2nd non-empty \n\t3rd non-empty \"";

const EX7_7 : &'static str = " 'here''s to \"quotes\"'";

const EX7_8 : &'static str =
    "'implicit block key' : [\n  'implicit flow key' : value,\n ]";

const EX7_9 : &'static str =
    "' 1st non-empty\n\n 2nd non-empty \n\t3rd non-empty '";

const EX7_10 : &'static str =
    "# Outside flow collection:\n- ::vector\n- \": - ()\"\n- Up, up, and away!\n- -123\n- http://example.com/foo#bar\n# Inside flow collection:\n- [ ::vector,\n  \": - ()\",\n  \"Up, up, and away!\",\n  -123,\n  http://example.com/foo#bar ]";

const EX7_11 : &'static str =
    "implicit block key : [\n  implicit flow key : value,\n ]";

const EX7_12 : &'static str =
    "1st non-empty\n\n 2nd non-empty \n\t3rd non-empty";

const EX7_13 : &'static str =
    "- [ one, two, ]\n- [three ,four]";

const EX7_14 : &'static str =
    "[\n\"double\n quoted\", 'single\n           quoted',\nplain\n text, [ nested ],\nsingle: pair,\n]";

const EX7_15 : &'static str =
    "- { one : two , three: four , }\n- {five: six,seven : eight}";

const EX7_16 : &'static str =
    "{\n? explicit: entry,\nimplicit: entry,\n?\n}";

const EX7_17 : &'static str =
    "{\nunquoted : \"separate\",\nhttp://foo.com,\nomitted value:,\n: omitted key,\n}";

const EX7_18 : &'static str =
    "{\n\"adjacent\":value,\n\"readable\":value,\n\"empty\":\n}";

const EX7_19 : &'static str =
    "[\nfoo: bar\n]";

const EX7_20 : &'static str =
    "[\n? foo\n bar : baz\n]";

const EX7_21 : &'static str =
    "- [ YAML : separate ]\n- [ : empty key entry ]\n- [ {JSON: like}:adjacent ]";

const EX7_22 : &'static str =
    "[ foo\n bar: invalid,";  // Note: we don't check (on purpose) the >1K chars for an
                       // implicit key

const EX7_23 : &'static str =
    "- [ a, b ]\n- { a: b }\n- \"a\"\n- 'b'\n- c";

const EX7_24 : &'static str =
    "- !!str \"a\"\n- 'b'\n- &anchor \"c\"\n- *anchor\n- !!str";

const EX8_1 : &'static str =
    "- | # Empty header\n literal\n- >1 # Indentation indicator\n  folded\n- |+ # Chomping indicator\n keep\n\n- >1- # Both indicators\n  strip\n";

const EX8_2 : &'static str =
    "- |\n detected\n- >\n \n  \n  # detected\n- |1\n  explicit\n- >\n \t\n detected\n";

const EX8_3a : &'static str =
    "- |\n  \n text";

const EX8_3b : &'static str =
    "- >\n  text\n text";

const EX8_3c : &'static str =
    "- |2\n text";

const EX8_4 : &'static str =
    "strip: |-\n  text\nclip: |\n  text\nkeep: |+\n  text\n";

const EX8_5 : &'static str =
    " # Strip\n  # Comments:\nstrip: |-\n  # text\n  \n # Clip\n  # comments:\n\nclip: |\n  # text\n \n # Keep\n  # comments:\n\nkeep: |+\n  # text\n\n # Trail\n  # Comments\n";

const EX8_6 : &'static str =
    "strip: >-\n\nclip: >\n\nkeep: |+\n\n";

const EX8_7 : &'static str =
    "|\n literal\n \ttext\n\n";

const EX8_8 : &'static str =
    "|\n \n  \n  literal\n   \n  \n  text\n\n # Comment\n";

const EX8_9 : &'static str =
    ">\n folded\n text\n\n";

const EX8_10 : &'static str =
    ">\n\n folded\n line\n\n next\n line\n   * bullet\n\n   * list\n   * lines\n\n last\n line\n\n# Comment\n";

const EX8_11 : &'static str = EX8_10;
const EX8_12 : &'static str = EX8_10;
const EX8_13 : &'static str = EX8_10;

const EX8_14 : &'static str =
    "block sequence:\n  - one\n  - two : three\n";

const EX8_15 : &'static str =
    "- # Empty\n- |\n block node\n- - one # Compact\n  - two # sequence\n- one: two # Compact mapping\n";

const EX8_16 : &'static str =
    "block mapping:\n key: value\n";

const EX8_17 : &'static str =
    "? explicit key # Empty value\n? |\n  block key\n: - one # Explicit compact\n  - two # block value\n";

// XXX libyaml failed this test
const EX8_18 : &'static str =
    "plain key: in-line value\n:  # Both empty\n\"quoted key\":\n- entry\n";

const EX8_19 : &'static str =
    "- sun: yellow\n- ? earth: blue\n  : moon: white\n";

const EX8_20 : &'static str =
    "-\n  \"flow in block\"\n- >\n Block scalar\n- !!map # Block collection\n  foo : bar\n";

const EX8_21 : &'static str =
    "literal: |2\n  value\nfolded:\n   !foo\n  >1\n value\n";

const EX8_22 : &'static str =
    "sequence: !!seq\n- entry\n- !!seq\n - nested\nmapping: !!map\n foo: bar\n";