3f93c982bff2f1f5a804bfe7ed0ff80598978146
[yaffs-website] / vendor / symfony / yaml / Tests / Fixtures / YtsSpecificationExamples.yml
1 --- %YAML:1.0
2 test: Sequence of scalars
3 spec: 2.1
4 yaml: |
5   - Mark McGwire
6   - Sammy Sosa
7   - Ken Griffey
8 php: |
9   array('Mark McGwire', 'Sammy Sosa', 'Ken Griffey')
10 ---
11 test: Mapping of scalars to scalars
12 spec: 2.2
13 yaml: |
14   hr:  65
15   avg: 0.278
16   rbi: 147
17 php: |
18   array('hr' => 65, 'avg' => 0.278, 'rbi' => 147)
19 ---
20 test: Mapping of scalars to sequences
21 spec: 2.3
22 yaml: |
23     american:
24        - Boston Red Sox
25        - Detroit Tigers
26        - New York Yankees
27     national:
28        - New York Mets
29        - Chicago Cubs
30        - Atlanta Braves
31 php: |
32     array('american' =>
33         array( 'Boston Red Sox', 'Detroit Tigers',
34           'New York Yankees' ),
35       'national' =>
36         array( 'New York Mets', 'Chicago Cubs',
37           'Atlanta Braves' )
38     )
39 ---
40 test: Sequence of mappings
41 spec: 2.4
42 yaml: |
43     -
44       name: Mark McGwire
45       hr:   65
46       avg:  0.278
47     -
48       name: Sammy Sosa
49       hr:   63
50       avg:  0.288
51 php: |
52     array(
53       array('name' => 'Mark McGwire', 'hr' => 65, 'avg' => 0.278),
54       array('name' => 'Sammy Sosa', 'hr' => 63, 'avg' => 0.288)
55     )
56 ---
57 test: Legacy A5
58 todo: true
59 spec: legacy_A5
60 yaml: |
61     ?
62         - New York Yankees
63         - Atlanta Braves
64     :
65       - 2001-07-02
66       - 2001-08-12
67       - 2001-08-14
68     ?
69         - Detroit Tigers
70         - Chicago Cubs
71     :
72       - 2001-07-23
73 perl-busted: >
74     YAML.pm will be able to emulate this behavior soon. In this regard
75     it may be somewhat more correct than Python's native behaviour which
76     can only use tuples as mapping keys. PyYAML will also need to figure
77     out some clever way to roundtrip structured keys.
78 python: |
79     [
80     {
81         ('New York Yankees', 'Atlanta Braves'):
82             [yaml.timestamp('2001-07-02'),
83              yaml.timestamp('2001-08-12'),
84              yaml.timestamp('2001-08-14')],
85         ('Detroit Tigers', 'Chicago Cubs'):
86         [yaml.timestamp('2001-07-23')]
87     }
88     ]
89 ruby: |
90     {
91       [ 'New York Yankees', 'Atlanta Braves' ] =>
92         [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ],
93       [ 'Detroit Tigers', 'Chicago Cubs' ] =>
94         [ Date.new( 2001, 7, 23 ) ]
95     }
96 syck: |
97   struct test_node seq1[] = {
98       { T_STR, 0, "New York Yankees" },
99       { T_STR, 0, "Atlanta Braves" },
100       end_node
101   };
102   struct test_node seq2[] = {
103       { T_STR, 0, "2001-07-02" },
104       { T_STR, 0, "2001-08-12" },
105       { T_STR, 0, "2001-08-14" },
106       end_node
107   };
108   struct test_node seq3[] = {
109       { T_STR, 0, "Detroit Tigers" },
110       { T_STR, 0, "Chicago Cubs" },
111       end_node
112   };
113   struct test_node seq4[] = {
114       { T_STR, 0, "2001-07-23" },
115       end_node
116   };
117   struct test_node map[] = {
118       { T_SEQ, 0, 0, seq1 },
119       { T_SEQ, 0, 0, seq2 },
120       { T_SEQ, 0, 0, seq3 },
121       { T_SEQ, 0, 0, seq4 },
122       end_node
123   };
124   struct test_node stream[] = {
125       { T_MAP, 0, 0, map },
126       end_node
127   };
128
129 ---
130 test: Sequence of sequences
131 spec: 2.5
132 yaml: |
133   - [ name         , hr , avg   ]
134   - [ Mark McGwire , 65 , 0.278 ]
135   - [ Sammy Sosa   , 63 , 0.288 ]
136 php: |
137   array(
138     array( 'name', 'hr', 'avg' ),
139     array( 'Mark McGwire', 65, 0.278 ),
140     array( 'Sammy Sosa', 63, 0.288 )
141   )
142 ---
143 test: Mapping of mappings
144 todo: true
145 spec: 2.6
146 yaml: |
147   Mark McGwire: {hr: 65, avg: 0.278}
148   Sammy Sosa: {
149       hr: 63,
150       avg: 0.288
151     }
152 php: |
153   array(
154     'Mark McGwire' =>
155       array( 'hr' => 65, 'avg' => 0.278 ),
156     'Sammy Sosa' =>
157       array( 'hr' => 63, 'avg' => 0.288 )
158   )
159 ---
160 test: Two documents in a stream each with a leading comment
161 todo: true
162 spec: 2.7
163 yaml: |
164   # Ranking of 1998 home runs
165   ---
166   - Mark McGwire
167   - Sammy Sosa
168   - Ken Griffey
169
170   # Team ranking
171   ---
172   - Chicago Cubs
173   - St Louis Cardinals
174 ruby: |
175   y = YAML::Stream.new
176   y.add( [ 'Mark McGwire', 'Sammy Sosa', 'Ken Griffey' ] )
177   y.add( [ 'Chicago Cubs', 'St Louis Cardinals' ] )
178 documents: 2
179
180 ---
181 test: Play by play feed from a game
182 todo: true
183 spec: 2.8
184 yaml: |
185   ---
186   time: 20:03:20
187   player: Sammy Sosa
188   action: strike (miss)
189   ...
190   ---
191   time: 20:03:47
192   player: Sammy Sosa
193   action: grand slam
194   ...
195 perl: |
196   [ 'Mark McGwire', 'Sammy Sosa', 'Ken Griffey' ]
197 documents: 2
198
199 ---
200 test: Single document with two comments
201 spec: 2.9
202 yaml: |
203   hr: # 1998 hr ranking
204     - Mark McGwire
205     - Sammy Sosa
206   rbi:
207     # 1998 rbi ranking
208     - Sammy Sosa
209     - Ken Griffey
210 php: |
211   array(
212     'hr' => array( 'Mark McGwire', 'Sammy Sosa' ),
213     'rbi' => array( 'Sammy Sosa', 'Ken Griffey' )
214   )
215 ---
216 test: Node for Sammy Sosa appears twice in this document
217 spec: 2.10
218 yaml: |
219    ---
220    hr:
221       - Mark McGwire
222       # Following node labeled SS
223       - &SS Sammy Sosa
224    rbi:
225       - *SS # Subsequent occurrence
226       - Ken Griffey
227 php: |
228    array(
229       'hr' =>
230          array('Mark McGwire', 'Sammy Sosa'),
231       'rbi' =>
232          array('Sammy Sosa', 'Ken Griffey')
233    )
234 ---
235 test: Mapping between sequences
236 todo: true
237 spec: 2.11
238 yaml: |
239    ? # PLAY SCHEDULE
240      - Detroit Tigers
241      - Chicago Cubs
242    :
243      - 2001-07-23
244
245    ? [ New York Yankees,
246        Atlanta Braves ]
247    : [ 2001-07-02, 2001-08-12,
248        2001-08-14 ]
249 ruby: |
250    {
251       [ 'Detroit Tigers', 'Chicago Cubs' ] => [ Date.new( 2001, 7, 23 ) ],
252       [ 'New York Yankees', 'Atlanta Braves' ] => [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ]
253    }
254 syck: |
255   struct test_node seq1[] = {
256       { T_STR, 0, "New York Yankees" },
257       { T_STR, 0, "Atlanta Braves" },
258       end_node
259   };
260   struct test_node seq2[] = {
261       { T_STR, 0, "2001-07-02" },
262       { T_STR, 0, "2001-08-12" },
263       { T_STR, 0, "2001-08-14" },
264       end_node
265   };
266   struct test_node seq3[] = {
267       { T_STR, 0, "Detroit Tigers" },
268       { T_STR, 0, "Chicago Cubs" },
269       end_node
270   };
271   struct test_node seq4[] = {
272       { T_STR, 0, "2001-07-23" },
273       end_node
274   };
275   struct test_node map[] = {
276       { T_SEQ, 0, 0, seq3 },
277       { T_SEQ, 0, 0, seq4 },
278       { T_SEQ, 0, 0, seq1 },
279       { T_SEQ, 0, 0, seq2 },
280       end_node
281   };
282   struct test_node stream[] = {
283       { T_MAP, 0, 0, map },
284       end_node
285   };
286
287 ---
288 test: Sequence key shortcut
289 spec: 2.12
290 yaml: |
291   ---
292   # products purchased
293   - item    : Super Hoop
294     quantity: 1
295   - item    : Basketball
296     quantity: 4
297   - item    : Big Shoes
298     quantity: 1
299 php: |
300   array (
301     array (
302       'item' => 'Super Hoop',
303       'quantity' => 1,
304     ),
305     array (
306       'item' => 'Basketball',
307       'quantity' => 4,
308     ),
309     array (
310       'item' => 'Big Shoes',
311       'quantity' => 1,
312     )
313   )
314 perl: |
315   [
316      { item => 'Super Hoop', quantity => 1 },
317      { item => 'Basketball', quantity => 4 },
318      { item => 'Big Shoes',  quantity => 1 }
319   ]
320
321 ruby: |
322   [
323      { 'item' => 'Super Hoop', 'quantity' => 1 },
324      { 'item' => 'Basketball', 'quantity' => 4 },
325      { 'item' => 'Big Shoes', 'quantity' => 1 }
326   ]
327 python: |
328   [
329        { 'item': 'Super Hoop', 'quantity': 1 },
330        { 'item': 'Basketball', 'quantity': 4 },
331        { 'item': 'Big Shoes',  'quantity': 1 }
332   ]
333 syck: |
334   struct test_node map1[] = {
335       { T_STR, 0, "item" },
336           { T_STR, 0, "Super Hoop" },
337       { T_STR, 0, "quantity" },
338           { T_STR, 0, "1" },
339       end_node
340   };
341   struct test_node map2[] = {
342       { T_STR, 0, "item" },
343           { T_STR, 0, "Basketball" },
344       { T_STR, 0, "quantity" },
345           { T_STR, 0, "4" },
346       end_node
347   };
348   struct test_node map3[] = {
349       { T_STR, 0, "item" },
350           { T_STR, 0, "Big Shoes" },
351       { T_STR, 0, "quantity" },
352           { T_STR, 0, "1" },
353       end_node
354   };
355   struct test_node seq[] = {
356       { T_MAP, 0, 0, map1 },
357       { T_MAP, 0, 0, map2 },
358       { T_MAP, 0, 0, map3 },
359       end_node
360   };
361   struct test_node stream[] = {
362       { T_SEQ, 0, 0, seq },
363       end_node
364   };
365
366
367 ---
368 test: Literal perserves newlines
369 todo: true
370 spec: 2.13
371 yaml: |
372   # ASCII Art
373   --- |
374     \//||\/||
375     // ||  ||_
376 perl: |
377   "\\//||\\/||\n// ||  ||_\n"
378 ruby: |
379   "\\//||\\/||\n// ||  ||_\n"
380 python: |
381     [
382         flushLeft(
383         """
384         \//||\/||
385         // ||  ||_
386         """
387         )
388     ]
389 syck: |
390   struct test_node stream[] = {
391       { T_STR, 0, "\\//||\\/||\n// ||  ||_\n" },
392       end_node
393   };
394
395 ---
396 test: Folded treats newlines as a space
397 todo: true
398 spec: 2.14
399 yaml: |
400   ---
401     Mark McGwire's
402     year was crippled
403     by a knee injury.
404 perl: |
405   "Mark McGwire's year was crippled by a knee injury."
406 ruby: |
407   "Mark McGwire's year was crippled by a knee injury."
408 python: |
409     [ "Mark McGwire's year was crippled by a knee injury." ]
410 syck: |
411   struct test_node stream[] = {
412       { T_STR, 0, "Mark McGwire's year was crippled by a knee injury." },
413       end_node
414   };
415
416 ---
417 test: Newlines preserved for indented and blank lines
418 todo: true
419 spec: 2.15
420 yaml: |
421   --- >
422    Sammy Sosa completed another
423    fine season with great stats.
424
425      63 Home Runs
426      0.288 Batting Average
427
428    What a year!
429 perl: |
430   "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n"
431 ruby: |
432   "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n"
433 python: |
434     [
435         flushLeft(
436         """
437         Sammy Sosa completed another fine season with great stats.
438
439           63 Home Runs
440           0.288 Batting Average
441
442         What a year!
443         """
444         )
445     ]
446 syck: |
447   struct test_node stream[] = {
448       { T_STR, 0, "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n" },
449       end_node
450   };
451
452
453 ---
454 test: Indentation determines scope
455 spec: 2.16
456 yaml: |
457   name: Mark McGwire
458   accomplishment: >
459      Mark set a major league
460      home run record in 1998.
461   stats: |
462      65 Home Runs
463      0.278 Batting Average
464 php: |
465   array(
466     'name' => 'Mark McGwire',
467     'accomplishment' => "Mark set a major league home run record in 1998.\n",
468     'stats' => "65 Home Runs\n0.278 Batting Average\n"
469   )
470 ---
471 test: Quoted scalars
472 todo: true
473 spec: 2.17
474 yaml: |
475   unicode: "Sosa did fine.\u263A"
476   control: "\b1998\t1999\t2000\n"
477   hexesc:  "\x0D\x0A is \r\n"
478
479   single: '"Howdy!" he cried.'
480   quoted: ' # not a ''comment''.'
481   tie-fighter: '|\-*-/|'
482 ruby: |
483   {
484     "tie-fighter" => "|\\-*-/|",
485     "control"=>"\0101998\t1999\t2000\n",
486     "unicode"=>"Sosa did fine." + ["263A".hex ].pack('U*'),
487     "quoted"=>" # not a 'comment'.",
488     "single"=>"\"Howdy!\" he cried.",
489     "hexesc"=>"\r\n is \r\n"
490   }
491 ---
492 test: Multiline flow scalars
493 todo: true
494 spec: 2.18
495 yaml: |
496   plain:
497     This unquoted scalar
498     spans many lines.
499
500   quoted: "So does this
501     quoted scalar.\n"
502 ruby: |
503   {
504     'plain' => 'This unquoted scalar spans many lines.',
505     'quoted' => "So does this quoted scalar.\n"
506   }
507 ---
508 test: Integers
509 spec: 2.19
510 yaml: |
511   canonical: 12345
512   octal: 014
513   hexadecimal: 0xC
514 php: |
515   array(
516     'canonical' => 12345,
517     'octal' => 014,
518     'hexadecimal' => 0xC
519   )
520 ---
521 test: Decimal Integer
522 deprecated: true
523 spec: 2.19
524 yaml: |
525   decimal: +12,345
526 php: |
527   array(
528     'decimal' => 12345.0,
529   )
530 ---
531 # FIX: spec shows parens around -inf and NaN
532 test: Floating point
533 spec: 2.20
534 yaml: |
535   canonical: 1.23015e+3
536   exponential: 12.3015e+02
537   negative infinity: -.inf
538   not a number: .NaN
539   float as whole number: !!float 1
540 php: |
541   array(
542     'canonical' => 1230.15,
543     'exponential' => 1230.15,
544     'negative infinity' => log(0),
545     'not a number' => -log(0),
546     'float as whole number' => (float) 1
547   )
548 ---
549 test: Fixed Floating point
550 deprecated: true
551 spec: 2.20
552 yaml: |
553   fixed: 1,230.15
554 php: |
555   array(
556     'fixed' => 1230.15,
557   )
558 ---
559 test: Timestamps
560 todo: true
561 spec: 2.22
562 yaml: |
563   canonical: 2001-12-15T02:59:43.1Z
564   iso8601:  2001-12-14t21:59:43.10-05:00
565   spaced:  2001-12-14 21:59:43.10 -05:00
566   date:   2002-12-14 # Time is noon UTC
567 php: |
568   array(
569     'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
570     'iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
571     'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
572     'date' => Date.new( 2002, 12, 14 )
573   )
574 ---
575 test: legacy Timestamps test
576 todo: true
577 spec: legacy D4
578 yaml: |
579     canonical: 2001-12-15T02:59:43.00Z
580     iso8601:  2001-02-28t21:59:43.00-05:00
581     spaced:  2001-12-14 21:59:43.00 -05:00
582     date:   2002-12-14
583 php: |
584    array(
585      'canonical' => Time::utc( 2001, 12, 15, 2, 59, 43, 0 ),
586      'iso8601' => YAML::mktime( 2001, 2, 28, 21, 59, 43, 0, "-05:00" ),
587      'spaced' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0, "-05:00" ),
588      'date' => Date.new( 2002, 12, 14 )
589    )
590 ---
591 test: Various explicit families
592 todo: true
593 spec: 2.23
594 yaml: |
595   not-date: !!str 2002-04-28
596   picture: !binary |
597    R0lGODlhDAAMAIQAAP//9/X
598    17unp5WZmZgAAAOfn515eXv
599    Pz7Y6OjuDg4J+fn5OTk6enp
600    56enmleECcgggoBADs=
601
602   application specific tag: !!something |
603    The semantics of the tag
604    above may be different for
605    different documents.
606
607 ruby-setup: |
608   YAML.add_private_type( "something" ) do |type, val|
609     "SOMETHING: #{val}"
610   end
611 ruby: |
612   {
613     'not-date' => '2002-04-28',
614     'picture' => "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236i^\020' \202\n\001\000;",
615     'application specific tag' => "SOMETHING: The semantics of the tag\nabove may be different for\ndifferent documents.\n"
616   }
617 ---
618 test: Application specific family
619 todo: true
620 spec: 2.24
621 yaml: |
622   # Establish a tag prefix
623   --- !clarkevans.com,2002/graph/^shape
624     # Use the prefix: shorthand for
625     # !clarkevans.com,2002/graph/circle
626   - !^circle
627     center: &ORIGIN {x: 73, 'y': 129}
628     radius: 7
629   - !^line # !clarkevans.com,2002/graph/line
630     start: *ORIGIN
631     finish: { x: 89, 'y': 102 }
632   - !^label
633     start: *ORIGIN
634     color: 0xFFEEBB
635     value: Pretty vector drawing.
636 ruby-setup: |
637   YAML.add_domain_type( "clarkevans.com,2002", 'graph/shape' ) { |type, val|
638     if Array === val
639       val << "Shape Container"
640       val
641     else
642       raise YAML::Error, "Invalid graph of class #{ val.class }: " + val.inspect
643     end
644   }
645   one_shape_proc = Proc.new { |type, val|
646     scheme, domain, type = type.split( /:/, 3 )
647     if val.is_a? ::Hash
648       val['TYPE'] = "Shape: #{type}"
649       val
650     else
651       raise YAML::Error, "Invalid graph of class #{ val.class }: " + val.inspect
652     end
653   }
654   YAML.add_domain_type( "clarkevans.com,2002", 'graph/circle', &one_shape_proc )
655   YAML.add_domain_type( "clarkevans.com,2002", 'graph/line', &one_shape_proc )
656   YAML.add_domain_type( "clarkevans.com,2002", 'graph/label', &one_shape_proc )
657 ruby: |
658   [
659     {
660       "radius" => 7,
661       "center"=>
662       {
663         "x" => 73,
664         "y" => 129
665       },
666       "TYPE" => "Shape: graph/circle"
667     }, {
668       "finish" =>
669       {
670         "x" => 89,
671         "y" => 102
672       },
673       "TYPE" => "Shape: graph/line",
674       "start" =>
675       {
676         "x" => 73,
677         "y" => 129
678       }
679     }, {
680       "TYPE" => "Shape: graph/label",
681       "value" => "Pretty vector drawing.",
682       "start" =>
683       {
684         "x" => 73,
685         "y" => 129
686       },
687       "color" => 16772795
688     },
689     "Shape Container"
690   ]
691 # ---
692 # test: Unordered set
693 # spec: 2.25
694 # yaml: |
695 #   # sets are represented as a
696 #   # mapping where each key is
697 #   # associated with the empty string
698 #   --- !set
699 #   ? Mark McGwire
700 #   ? Sammy Sosa
701 #   ? Ken Griff
702 ---
703 test: Ordered mappings
704 todo: true
705 spec: 2.26
706 yaml: |
707   # ordered maps are represented as
708   # a sequence of mappings, with
709   # each mapping having one key
710   --- !omap
711   - Mark McGwire: 65
712   - Sammy Sosa: 63
713   - Ken Griffy: 58
714 ruby: |
715   YAML::Omap[
716     'Mark McGwire', 65,
717     'Sammy Sosa', 63,
718     'Ken Griffy', 58
719   ]
720 ---
721 test: Invoice
722 dump_skip: true
723 spec: 2.27
724 yaml: |
725   --- !clarkevans.com,2002/^invoice
726   invoice: 34843
727   date   : 2001-01-23
728   bill-to: &id001
729       given  : Chris
730       family : Dumars
731       address:
732           lines: |
733               458 Walkman Dr.
734               Suite #292
735           city    : Royal Oak
736           state   : MI
737           postal  : 48046
738   ship-to: *id001
739   product:
740       -
741         sku         : BL394D
742         quantity    : 4
743         description : Basketball
744         price       : 450.00
745       -
746         sku         : BL4438H
747         quantity    : 1
748         description : Super Hoop
749         price       : 2392.00
750   tax  : 251.42
751   total: 4443.52
752   comments: >
753     Late afternoon is best.
754     Backup contact is Nancy
755     Billsmer @ 338-4338.
756 php: |
757   array(
758      'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
759      'bill-to' =>
760       array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
761      , 'ship-to' =>
762       array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
763      , 'product' =>
764        array(
765         array( 'sku' => 'BL394D', 'quantity' => 4, 'description' => 'Basketball', 'price' => 450.00 ),
766         array( 'sku' => 'BL4438H', 'quantity' => 1, 'description' => 'Super Hoop', 'price' => 2392.00 )
767       ),
768      'tax' => 251.42, 'total' => 4443.52,
769      'comments' => "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.\n"
770   )
771 ---
772 test: Log file
773 todo: true
774 spec: 2.28
775 yaml: |
776   ---
777   Time: 2001-11-23 15:01:42 -05:00
778   User: ed
779   Warning: >
780     This is an error message
781     for the log file
782   ---
783   Time: 2001-11-23 15:02:31 -05:00
784   User: ed
785   Warning: >
786     A slightly different error
787     message.
788   ---
789   Date: 2001-11-23 15:03:17 -05:00
790   User: ed
791   Fatal: >
792     Unknown variable "bar"
793   Stack:
794     - file: TopClass.py
795       line: 23
796       code: |
797         x = MoreObject("345\n")
798     - file: MoreClass.py
799       line: 58
800       code: |-
801         foo = bar
802 ruby: |
803   y = YAML::Stream.new
804   y.add( { 'Time' => YAML::mktime( 2001, 11, 23, 15, 01, 42, 00, "-05:00" ),
805            'User' => 'ed', 'Warning' => "This is an error message for the log file\n" } )
806   y.add( { 'Time' => YAML::mktime( 2001, 11, 23, 15, 02, 31, 00, "-05:00" ),
807            'User' => 'ed', 'Warning' => "A slightly different error message.\n" } )
808   y.add( { 'Date' => YAML::mktime( 2001, 11, 23, 15, 03, 17, 00, "-05:00" ),
809            'User' => 'ed', 'Fatal' => "Unknown variable \"bar\"\n",
810            'Stack' => [
811            { 'file' => 'TopClass.py', 'line' => 23, 'code' => "x = MoreObject(\"345\\n\")\n" },
812            { 'file' => 'MoreClass.py', 'line' => 58, 'code' => "foo = bar" } ] } )
813 documents: 3
814
815 ---
816 test: Throwaway comments
817 yaml: |
818    ### These are four throwaway comment  ###
819
820    ### lines (the second line is empty). ###
821    this: |   # Comments may trail lines.
822       contains three lines of text.
823       The third one starts with a
824       # character. This isn't a comment.
825
826    # These are three throwaway comment
827    # lines (the first line is empty).
828 php: |
829    array(
830      'this' => "contains three lines of text.\nThe third one starts with a\n# character. This isn't a comment.\n"
831    )
832 ---
833 test: Document with a single value
834 todo: true
835 yaml: |
836    --- >
837    This YAML stream contains a single text value.
838    The next stream is a log file - a sequence of
839    log entries. Adding an entry to the log is a
840    simple matter of appending it at the end.
841 ruby: |
842    "This YAML stream contains a single text value. The next stream is a log file - a sequence of log entries. Adding an entry to the log is a simple matter of appending it at the end.\n"
843 ---
844 test: Document stream
845 todo: true
846 yaml: |
847    ---
848    at: 2001-08-12 09:25:00.00 Z
849    type: GET
850    HTTP: '1.0'
851    url: '/index.html'
852    ---
853    at: 2001-08-12 09:25:10.00 Z
854    type: GET
855    HTTP: '1.0'
856    url: '/toc.html'
857 ruby: |
858    y = YAML::Stream.new
859    y.add( {
860       'at' => Time::utc( 2001, 8, 12, 9, 25, 00 ),
861       'type' => 'GET',
862       'HTTP' => '1.0',
863       'url' => '/index.html'
864    } )
865    y.add( {
866       'at' => Time::utc( 2001, 8, 12, 9, 25, 10 ),
867       'type' => 'GET',
868       'HTTP' => '1.0',
869       'url' => '/toc.html'
870    } )
871 documents: 2
872
873 ---
874 test: Top level mapping
875 yaml: |
876    # This stream is an example of a top-level mapping.
877    invoice : 34843
878    date    : 2001-01-23
879    total   : 4443.52
880 php: |
881    array(
882       'invoice' => 34843,
883       'date' => gmmktime(0, 0, 0, 1, 23, 2001),
884       'total' => 4443.52
885    )
886 ---
887 test: Single-line documents
888 todo: true
889 yaml: |
890   # The following is a sequence of three documents.
891   # The first contains an empty mapping, the second
892   # an empty sequence, and the last an empty string.
893   --- {}
894   --- [ ]
895   --- ''
896 ruby: |
897   y = YAML::Stream.new
898   y.add( {} )
899   y.add( [] )
900   y.add( '' )
901 documents: 3
902
903 ---
904 test: Document with pause
905 todo: true
906 yaml: |
907   # A communication channel based on a YAML stream.
908   ---
909   sent at: 2002-06-06 11:46:25.10 Z
910   payload: Whatever
911   # Receiver can process this as soon as the following is sent:
912   ...
913   # Even if the next message is sent long after:
914   ---
915   sent at: 2002-06-06 12:05:53.47 Z
916   payload: Whatever
917   ...
918 ruby: |
919   y = YAML::Stream.new
920   y.add(
921     { 'sent at' => YAML::mktime( 2002, 6, 6, 11, 46, 25, 0.10 ),
922       'payload' => 'Whatever' }
923   )
924   y.add(
925     { "payload" => "Whatever", "sent at" => YAML::mktime( 2002, 6, 6, 12, 5, 53, 0.47 ) }
926   )
927 documents: 2
928
929 ---
930 test: Explicit typing
931 deprecated: Using the non-specific tag "!" is deprecated since Symfony 3.4 as its behavior will change in 4.0.
932 yaml: |
933    integer: 12
934    also int: ! "12"
935    string: !!str 12
936 php: |
937    array( 'integer' => 12, 'also int' => 12, 'string' => '12' )
938 ---
939 test: Private types
940 todo: true
941 yaml: |
942   # Both examples below make use of the 'x-private:ball'
943   # type family URI, but with different semantics.
944   ---
945   pool: !!ball
946     number: 8
947     color: black
948   ---
949   bearing: !!ball
950     material: steel
951 ruby: |
952   y = YAML::Stream.new
953   y.add( { 'pool' =>
954     YAML::PrivateType.new( 'ball',
955       { 'number' => 8, 'color' => 'black' } ) }
956   )
957   y.add( { 'bearing' =>
958     YAML::PrivateType.new( 'ball',
959       { 'material' => 'steel' } ) }
960   )
961 documents: 2
962
963 ---
964 test: Type family under yaml.org
965 yaml: |
966   # The URI is 'tag:yaml.org,2002:str'
967   - !!str a Unicode string
968 php: |
969   array( 'a Unicode string' )
970 ---
971 test: Type family under perl.yaml.org
972 todo: true
973 yaml: |
974   # The URI is 'tag:perl.yaml.org,2002:Text::Tabs'
975   - !perl/Text::Tabs {}
976 ruby: |
977   [ YAML::DomainType.new( 'perl.yaml.org,2002', 'Text::Tabs', {} ) ]
978 ---
979 test: Type family under clarkevans.com
980 todo: true
981 yaml: |
982   # The URI is 'tag:clarkevans.com,2003-02:timesheet'
983   - !clarkevans.com,2003-02/timesheet {}
984 ruby: |
985   [ YAML::DomainType.new( 'clarkevans.com,2003-02', 'timesheet', {} ) ]
986 ---
987 test: URI Escaping
988 todo: true
989 yaml: |
990   same:
991     - !domain.tld,2002/type\x30 value
992     - !domain.tld,2002/type0 value
993   different: # As far as the YAML parser is concerned
994     - !domain.tld,2002/type%30 value
995     - !domain.tld,2002/type0 value
996 ruby-setup: |
997   YAML.add_domain_type( "domain.tld,2002", "type0" ) { |type, val|
998     "ONE: #{val}"
999   }
1000   YAML.add_domain_type( "domain.tld,2002", "type%30" ) { |type, val|
1001     "TWO: #{val}"
1002   }
1003 ruby: |
1004   { 'same' => [ 'ONE: value', 'ONE: value' ], 'different' => [ 'TWO: value', 'ONE: value' ] }
1005 ---
1006 test: URI Prefixing
1007 todo: true
1008 yaml: |
1009   # 'tag:domain.tld,2002:invoice' is some type family.
1010   invoice: !domain.tld,2002/^invoice
1011     # 'seq' is shorthand for 'tag:yaml.org,2002:seq'.
1012     # This does not effect '^customer' below
1013     # because it is does not specify a prefix.
1014     customers: !seq
1015       # '^customer' is shorthand for the full
1016       # notation 'tag:domain.tld,2002:customer'.
1017       - !^customer
1018         given : Chris
1019         family : Dumars
1020 ruby-setup: |
1021   YAML.add_domain_type( "domain.tld,2002", /(invoice|customer)/ ) { |type, val|
1022     if val.is_a? ::Hash
1023       scheme, domain, type = type.split( /:/, 3 )
1024       val['type'] = "domain #{type}"
1025       val
1026     else
1027       raise YAML::Error, "Not a Hash in domain.tld/invoice: " + val.inspect
1028     end
1029   }
1030 ruby: |
1031   { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }
1032
1033 ---
1034 test: Overriding anchors
1035 yaml: |
1036   anchor : &A001 This scalar has an anchor.
1037   override : &A001 >
1038    The alias node below is a
1039    repeated use of this value.
1040   alias : *A001
1041 php: |
1042   array( 'anchor' => 'This scalar has an anchor.',
1043     'override' => "The alias node below is a repeated use of this value.\n",
1044     'alias' => "The alias node below is a repeated use of this value.\n" )
1045 ---
1046 test: Flow and block formatting
1047 todo: true
1048 yaml: |
1049   empty: []
1050   flow: [ one, two, three # May span lines,
1051            , four,           # indentation is
1052              five ]          # mostly ignored.
1053   block:
1054    - First item in top sequence
1055    -
1056     - Subordinate sequence entry
1057    - >
1058      A folded sequence entry
1059    - Sixth item in top sequence
1060 ruby: |
1061   { 'empty' => [], 'flow' => [ 'one', 'two', 'three', 'four', 'five' ],
1062     'block' => [ 'First item in top sequence', [ 'Subordinate sequence entry' ],
1063     "A folded sequence entry\n", 'Sixth item in top sequence' ] }
1064 ---
1065 test: Complete mapping test
1066 todo: true
1067 yaml: |
1068  empty: {}
1069  flow: { one: 1, two: 2 }
1070  spanning: { one: 1,
1071     two: 2 }
1072  block:
1073   first : First entry
1074   second:
1075    key: Subordinate mapping
1076   third:
1077    - Subordinate sequence
1078    - { }
1079    - Previous mapping is empty.
1080    - A key: value pair in a sequence.
1081      A second: key:value pair.
1082    - The previous entry is equal to the following one.
1083    -
1084      A key: value pair in a sequence.
1085      A second: key:value pair.
1086   !float 12 : This key is a float.
1087   ? >
1088    ?
1089   : This key had to be protected.
1090   "\a" : This key had to be escaped.
1091   ? >
1092    This is a
1093    multi-line
1094    folded key
1095   : Whose value is
1096     also multi-line.
1097   ? this also works as a key
1098   : with a value at the next line.
1099   ?
1100    - This key
1101    - is a sequence
1102   :
1103    - With a sequence value.
1104   ?
1105    This: key
1106    is a: mapping
1107   :
1108    with a: mapping value.
1109 ruby: |
1110   { 'empty' => {}, 'flow' => { 'one' => 1, 'two' => 2 },
1111     'spanning' => { 'one' => 1, 'two' => 2 },
1112     'block' => { 'first' => 'First entry', 'second' =>
1113     { 'key' => 'Subordinate mapping' }, 'third' =>
1114       [ 'Subordinate sequence', {}, 'Previous mapping is empty.',
1115         { 'A key' => 'value pair in a sequence.', 'A second' => 'key:value pair.' },
1116         'The previous entry is equal to the following one.',
1117         { 'A key' => 'value pair in a sequence.', 'A second' => 'key:value pair.' } ],
1118     12.0 => 'This key is a float.', "?\n" => 'This key had to be protected.',
1119     "\a" => 'This key had to be escaped.',
1120     "This is a multi-line folded key\n" => "Whose value is also multi-line.",
1121     'this also works as a key' => 'with a value at the next line.',
1122     [ 'This key', 'is a sequence' ] => [ 'With a sequence value.' ] } }
1123   # Couldn't recreate map exactly, so we'll do a detailed check to be sure it's entact
1124   obj_y['block'].keys.each { |k|
1125     if Hash === k
1126       v = obj_y['block'][k]
1127       if k['This'] == 'key' and k['is a'] == 'mapping' and v['with a'] == 'mapping value.'
1128          obj_r['block'][k] = v
1129       end
1130     end
1131   }
1132 ---
1133 test: Literal explicit indentation
1134 yaml: |
1135    # Explicit indentation must
1136    # be given in all the three
1137    # following cases.
1138    leading spaces: |2
1139          This value starts with four spaces.
1140
1141    leading line break: |2
1142
1143      This value starts with a line break.
1144
1145    leading comment indicator: |2
1146      # first line starts with a
1147      # character.
1148
1149    # Explicit indentation may
1150    # also be given when it is
1151    # not required.
1152    redundant: |2
1153      This value is indented 2 spaces.
1154 php: |
1155    array(
1156       'leading spaces' => "    This value starts with four spaces.\n",
1157       'leading line break' => "\nThis value starts with a line break.\n",
1158       'leading comment indicator' => "# first line starts with a\n# character.\n",
1159       'redundant' => "This value is indented 2 spaces.\n"
1160    )
1161 ---
1162 test: Chomping and keep modifiers
1163 yaml: |
1164     clipped: |
1165         This has one newline.
1166
1167     same as "clipped" above: "This has one newline.\n"
1168
1169     stripped: |-
1170         This has no newline.
1171
1172     same as "stripped" above: "This has no newline."
1173
1174     kept: |+
1175         This has two newlines.
1176
1177     same as "kept" above: "This has two newlines.\n\n"
1178 php: |
1179     array(
1180       'clipped' => "This has one newline.\n",
1181       'same as "clipped" above' => "This has one newline.\n",
1182       'stripped' => 'This has no newline.',
1183       'same as "stripped" above' => 'This has no newline.',
1184       'kept' => "This has two newlines.\n\n",
1185       'same as "kept" above' => "This has two newlines.\n\n"
1186     )
1187 ---
1188 test: Literal combinations
1189 todo: true
1190 yaml: |
1191    empty: |
1192
1193    literal: |
1194     The \ ' " characters may be
1195     freely used. Leading white
1196        space is significant.
1197
1198     Line breaks are significant.
1199     Thus this value contains one
1200     empty line and ends with a
1201     single line break, but does
1202     not start with one.
1203
1204    is equal to: "The \\ ' \" characters may \
1205     be\nfreely used. Leading white\n   space \
1206     is significant.\n\nLine breaks are \
1207     significant.\nThus this value contains \
1208     one\nempty line and ends with a\nsingle \
1209     line break, but does\nnot start with one.\n"
1210
1211    # Comments may follow a block
1212    # scalar value. They must be
1213    # less indented.
1214
1215    # Modifiers may be combined in any order.
1216    indented and chomped: |2-
1217        This has no newline.
1218
1219    also written as: |-2
1220        This has no newline.
1221
1222    both are equal to: "  This has no newline."
1223 php: |
1224    array(
1225      'empty' => '',
1226      'literal' => "The \\ ' \" characters may be\nfreely used. Leading white\n   space " +
1227        "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +
1228        "empty line and ends with a\nsingle line break, but does\nnot start with one.\n",
1229      'is equal to' => "The \\ ' \" characters may be\nfreely used. Leading white\n   space " +
1230        "is significant.\n\nLine breaks are significant.\nThus this value contains one\n" +
1231        "empty line and ends with a\nsingle line break, but does\nnot start with one.\n",
1232      'indented and chomped' => '  This has no newline.',
1233      'also written as' => '  This has no newline.',
1234      'both are equal to' => '  This has no newline.'
1235    )
1236 ---
1237 test: Folded combinations
1238 todo: true
1239 yaml: |
1240    empty: >
1241
1242    one paragraph: >
1243     Line feeds are converted
1244     to spaces, so this value
1245     contains no line breaks
1246     except for the final one.
1247
1248    multiple paragraphs: >2
1249
1250      An empty line, either
1251      at the start or in
1252      the value:
1253
1254      Is interpreted as a
1255      line break. Thus this
1256      value contains three
1257      line breaks.
1258
1259    indented text: >
1260        This is a folded
1261        paragraph followed
1262        by a list:
1263         * first entry
1264         * second entry
1265        Followed by another
1266        folded paragraph,
1267        another list:
1268
1269         * first entry
1270
1271         * second entry
1272
1273        And a final folded
1274        paragraph.
1275
1276    above is equal to: |
1277        This is a folded paragraph followed by a list:
1278         * first entry
1279         * second entry
1280        Followed by another folded paragraph, another list:
1281
1282         * first entry
1283
1284         * second entry
1285
1286        And a final folded paragraph.
1287
1288    # Explicit comments may follow
1289    # but must be less indented.
1290 php: |
1291    array(
1292      'empty' => '',
1293      'one paragraph' => 'Line feeds are converted to spaces, so this value'.
1294        " contains no line breaks except for the final one.\n",
1295      'multiple paragraphs' => "\nAn empty line, either at the start or in the value:\n".
1296        "Is interpreted as a line break. Thus this value contains three line breaks.\n",
1297      'indented text' => "This is a folded paragraph followed by a list:\n".
1298        " * first entry\n * second entry\nFollowed by another folded paragraph, ".
1299        "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n",
1300      'above is equal to' => "This is a folded paragraph followed by a list:\n".
1301        " * first entry\n * second entry\nFollowed by another folded paragraph, ".
1302        "another list:\n\n * first entry\n\n * second entry\n\nAnd a final folded paragraph.\n"
1303    )
1304 ---
1305 test: Single quotes
1306 todo: true
1307 yaml: |
1308    empty: ''
1309    second: '! : \ etc. can be used freely.'
1310    third: 'a single quote '' must be escaped.'
1311    span: 'this contains
1312          six spaces
1313
1314          and one
1315          line break'
1316    is same as: "this contains six spaces\nand one line break"
1317 php: |
1318    array(
1319      'empty' => '',
1320      'second' => '! : \\ etc. can be used freely.',
1321      'third' => "a single quote ' must be escaped.",
1322      'span' => "this contains six spaces\nand one line break",
1323      'is same as' => "this contains six spaces\nand one line break"
1324    )
1325 ---
1326 test: Double quotes
1327 todo: true
1328 yaml: |
1329    empty: ""
1330    second: "! : etc. can be used freely."
1331    third: "a \" or a \\ must be escaped."
1332    fourth: "this value ends with an LF.\n"
1333    span: "this contains
1334      four  \
1335          spaces"
1336    is equal to: "this contains four  spaces"
1337 php: |
1338    array(
1339      'empty' => '',
1340      'second' => '! : etc. can be used freely.',
1341      'third' => 'a " or a \\ must be escaped.',
1342      'fourth' => "this value ends with an LF.\n",
1343      'span' => "this contains four  spaces",
1344      'is equal to' => "this contains four  spaces"
1345    )
1346 ---
1347 test: Unquoted strings
1348 todo: true
1349 yaml: |
1350    first: There is no unquoted empty string.
1351
1352    second: 12          ## This is an integer.
1353
1354    third: !!str 12      ## This is a string.
1355
1356    span: this contains
1357          six spaces
1358
1359          and one
1360          line break
1361
1362    indicators: this has no comments.
1363                #:foo and bar# are
1364                both text.
1365
1366    flow: [ can span
1367               lines, # comment
1368               like
1369               this ]
1370
1371    note: { one-line keys: but multi-line values }
1372
1373 php: |
1374    array(
1375      'first' => 'There is no unquoted empty string.',
1376      'second' => 12,
1377      'third' => '12',
1378      'span' => "this contains six spaces\nand one line break",
1379      'indicators' => "this has no comments. #:foo and bar# are both text.",
1380      'flow' => [ 'can span lines', 'like this' ],
1381      'note' => { 'one-line keys' => 'but multi-line values' }
1382    )
1383 ---
1384 test: Spanning sequences
1385 todo: true
1386 yaml: |
1387    # The following are equal seqs
1388    # with different identities.
1389    flow: [ one, two ]
1390    spanning: [ one,
1391         two ]
1392    block:
1393      - one
1394      - two
1395 php: |
1396    array(
1397      'flow' => [ 'one', 'two' ],
1398      'spanning' => [ 'one', 'two' ],
1399      'block' => [ 'one', 'two' ]
1400    )
1401 ---
1402 test: Flow mappings
1403 yaml: |
1404    # The following are equal maps
1405    # with different identities.
1406    flow: { one: 1, two: 2 }
1407    block:
1408        one: 1
1409        two: 2
1410 php: |
1411    array(
1412      'flow' => array( 'one' => 1, 'two' => 2 ),
1413      'block' => array( 'one' => 1, 'two' => 2 )
1414    )
1415 ---
1416 test: Representations of 12
1417 todo: true
1418 yaml: |
1419    - 12 # An integer
1420    # The following scalars
1421    # are loaded to the
1422    # string value '1' '2'.
1423    - !!str 12
1424    - '12'
1425    - "12"
1426    - "\
1427      1\
1428      2\
1429      "
1430    # Strings containing paths and regexps can be unquoted:
1431    - /foo/bar
1432    - d:/foo/bar
1433    - foo/bar
1434    - /a.*b/
1435 php: |
1436    array( 12, '12', '12', '12', '12', '/foo/bar', 'd:/foo/bar', 'foo/bar', '/a.*b/' )
1437 ---
1438 test: "Null"
1439 todo: true
1440 yaml: |
1441    canonical: ~
1442
1443    english: null
1444
1445    # This sequence has five
1446    # entries, two with values.
1447    sparse:
1448      - ~
1449      - 2nd entry
1450      - Null
1451      - 4th entry
1452      -
1453
1454    four: This mapping has five keys,
1455          only two with values.
1456
1457 php: |
1458    array (
1459      'canonical' => null,
1460      'english' => null,
1461      'sparse' => array( null, '2nd entry', null, '4th entry', null ]),
1462      'four' => 'This mapping has five keys, only two with values.'
1463    )
1464 ---
1465 test: Omap
1466 todo: true
1467 yaml: |
1468    # Explicitly typed dictionary.
1469    Bestiary: !omap
1470      - aardvark: African pig-like ant eater. Ugly.
1471      - anteater: South-American ant eater. Two species.
1472      - anaconda: South-American constrictor snake. Scary.
1473      # Etc.
1474 ruby: |
1475    {
1476      'Bestiary' => YAML::Omap[
1477        'aardvark', 'African pig-like ant eater. Ugly.',
1478        'anteater', 'South-American ant eater. Two species.',
1479        'anaconda', 'South-American constrictor snake. Scary.'
1480      ]
1481    }
1482
1483 ---
1484 test: Pairs
1485 todo: true
1486 yaml: |
1487   # Explicitly typed pairs.
1488   tasks: !pairs
1489     - meeting: with team.
1490     - meeting: with boss.
1491     - break: lunch.
1492     - meeting: with client.
1493 ruby: |
1494   {
1495     'tasks' => YAML::Pairs[
1496       'meeting', 'with team.',
1497       'meeting', 'with boss.',
1498       'break', 'lunch.',
1499       'meeting', 'with client.'
1500     ]
1501   }
1502
1503 ---
1504 test: Set
1505 todo: true
1506 yaml: |
1507   # Explicitly typed set.
1508   baseball players: !set
1509     Mark McGwire:
1510     Sammy Sosa:
1511     Ken Griffey:
1512 ruby: |
1513   {
1514     'baseball players' => YAML::Set[
1515       'Mark McGwire', nil,
1516       'Sammy Sosa', nil,
1517       'Ken Griffey', nil
1518     ]
1519   }
1520
1521 ---
1522 test: Integer
1523 yaml: |
1524    canonical: 12345
1525    octal: 014
1526    hexadecimal: 0xC
1527 php: |
1528    array(
1529      'canonical' => 12345,
1530      'octal' => 12,
1531      'hexadecimal' => 12
1532    )
1533 ---
1534 test: Decimal
1535 deprecated: true
1536 yaml: |
1537    decimal: +12,345
1538 php: |
1539    array(
1540      'decimal' => 12345.0,
1541    )
1542 ---
1543 test: Fixed Float
1544 deprecated: true
1545 yaml: |
1546    fixed: 1,230.15
1547 php: |
1548   array(
1549     'fixed' => 1230.15,
1550   )
1551 ---
1552 test: Float
1553 yaml: |
1554    canonical: 1.23015e+3
1555    exponential: 12.3015e+02
1556    negative infinity: -.inf
1557    not a number: .NaN
1558 php: |
1559   array(
1560     'canonical' => 1230.15,
1561     'exponential' => 1230.15,
1562     'negative infinity' => log(0),
1563     'not a number' => -log(0)
1564   )
1565 ---
1566 test: Timestamp
1567 todo: true
1568 yaml: |
1569    canonical:       2001-12-15T02:59:43.1Z
1570    valid iso8601:   2001-12-14t21:59:43.10-05:00
1571    space separated: 2001-12-14 21:59:43.10 -05:00
1572    date (noon UTC): 2002-12-14
1573 ruby: |
1574    array(
1575      'canonical' => YAML::mktime( 2001, 12, 15, 2, 59, 43, 0.10 ),
1576      'valid iso8601' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
1577      'space separated' => YAML::mktime( 2001, 12, 14, 21, 59, 43, 0.10, "-05:00" ),
1578      'date (noon UTC)' => Date.new( 2002, 12, 14 )
1579    )
1580 ---
1581 test: Binary
1582 todo: true
1583 yaml: |
1584    canonical: !binary "\
1585     R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\
1586     OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\
1587     +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\
1588     AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
1589    base64: !binary |
1590     R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
1591     OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
1592     +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
1593     AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
1594    description: >
1595     The binary value above is a tiny arrow
1596     encoded as a gif image.
1597 ruby-setup: |
1598    arrow_gif = "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236iiiccc\243\243\243\204\204\204\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371!\376\016Made with GIMP\000,\000\000\000\000\f\000\f\000\000\005,  \216\2010\236\343@\024\350i\020\304\321\212\010\034\317\200M$z\357\3770\205p\270\2601f\r\e\316\001\303\001\036\020' \202\n\001\000;"
1599 ruby: |
1600    {
1601      'canonical' => arrow_gif,
1602      'base64' => arrow_gif,
1603      'description' => "The binary value above is a tiny arrow encoded as a gif image.\n"
1604    }
1605
1606 ---
1607 test: Merge key
1608 todo: true
1609 yaml: |
1610   ---
1611   - &CENTER { x: 1, y: 2 }
1612   - &LEFT { x: 0, y: 2 }
1613   - &BIG { r: 10 }
1614   - &SMALL { r: 1 }
1615
1616   # All the following maps are equal:
1617
1618   - # Explicit keys
1619     x: 1
1620     y: 2
1621     r: 10
1622     label: center/big
1623
1624   - # Merge one map
1625     << : *CENTER
1626     r: 10
1627     label: center/big
1628
1629   - # Merge multiple maps
1630     << : [ *CENTER, *BIG ]
1631     label: center/big
1632
1633   - # Override
1634     << : [ *BIG, *LEFT, *SMALL ]
1635     x: 1
1636     label: center/big
1637
1638 ruby-setup: |
1639   center = { 'x' => 1, 'y' => 2 }
1640   left = { 'x' => 0, 'y' => 2 }
1641   big = { 'r' => 10 }
1642   small = { 'r' => 1 }
1643   node1 = { 'x' => 1, 'y' => 2, 'r' => 10, 'label' => 'center/big' }
1644   node2 = center.dup
1645   node2.update( { 'r' => 10, 'label' => 'center/big' } )
1646   node3 = big.dup
1647   node3.update( center )
1648   node3.update( { 'label' => 'center/big' } )
1649   node4 = small.dup
1650   node4.update( left )
1651   node4.update( big )
1652   node4.update( { 'x' => 1, 'label' => 'center/big' } )
1653
1654 ruby: |
1655   [
1656     center, left, big, small, node1, node2, node3, node4
1657   ]
1658
1659 ---
1660 test: Default key
1661 todo: true
1662 yaml: |
1663    ---     # Old schema
1664    link with:
1665      - library1.dll
1666      - library2.dll
1667    ---     # New schema
1668    link with:
1669      - = : library1.dll
1670        version: 1.2
1671      - = : library2.dll
1672        version: 2.3
1673 ruby: |
1674    y = YAML::Stream.new
1675    y.add( { 'link with' => [ 'library1.dll', 'library2.dll' ] } )
1676    obj_h = Hash[ 'version' => 1.2 ]
1677    obj_h.default = 'library1.dll'
1678    obj_h2 = Hash[ 'version' => 2.3 ]
1679    obj_h2.default = 'library2.dll'
1680    y.add( { 'link with' => [ obj_h, obj_h2 ] } )
1681 documents: 2
1682
1683 ---
1684 test: Special keys
1685 todo: true
1686 yaml: |
1687    "!": These three keys
1688    "&": had to be quoted
1689    "=": and are normal strings.
1690    # NOTE: the following node should NOT be serialized this way.
1691    encoded node :
1692     !special '!' : '!type'
1693     !special|canonical '&' : 12
1694     = : value
1695    # The proper way to serialize the above node is as follows:
1696    node : !!type &12 value
1697 ruby: |
1698    { '!' => 'These three keys', '&' => 'had to be quoted',
1699      '=' => 'and are normal strings.',
1700      'encoded node' => YAML::PrivateType.new( 'type', 'value' ),
1701      'node' => YAML::PrivateType.new( 'type', 'value' ) }