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
|
use strict;
use lib -e 't' ? 't' : 'test';
use TestYAML tests => 19;
run_roundtrip_nyn();
__DATA__
===
+++ config
local $YAML::UseHeader = 0
+++ perl
(['34', '45'], ['56', '67'])
+++ yaml
- 34
- 45
---
- 56
- 67
===
+++ no_round_trip
+++ config
local $YAML::UseAliases = 0
+++ perl
my $ref = {foo => 'bar'};
[$ref, $ref]
+++ yaml
---
- foo: bar
- foo: bar
===
+++ config
local $YAML::CompressSeries = 1
+++ perl
[
{foo => 'bar'},
{lips => 'red', crown => 'head'},
{trix => [ 'foo', {silly => 'rabbit', bratty => 'kids', } ] },
]
+++ yaml
---
- foo: bar
- crown: head
lips: red
- trix:
- foo
- bratty: kids
silly: rabbit
===
+++ config
local $YAML::CompressSeries = 0;
local $YAML::Indent = 5
+++ perl
[
{one => 'fun', pun => 'none'},
two => 'foo',
{three => [ {free => 'willy', dally => 'dilly'} ]},
]
+++ yaml
---
-
one: fun
pun: none
- two
- foo
-
three:
-
dally: dilly
free: willy
===
+++ config
local $YAML::CompressSeries = 1;
local $YAML::Indent = 5
+++ perl
[
{one => 'fun', pun => 'none'},
two => {foo => {true => 'blue'}},
{three => [ {free => 'willy', dally => 'dilly'} ]},
]
+++ yaml
---
- one: fun
pun: none
- two
- foo:
true: blue
- three:
- dally: dilly
free: willy
===
+++ config
local $YAML::Indent = 3
+++ perl
[{ one => 'two', three => 'four' }, { foo => 'bar' }, ]
+++ yaml
---
- one: two
three: four
- foo: bar
===
+++ config
local $YAML::CompressSeries = 1
+++ perl
[
'The',
{speed => 'quick', color => 'brown', &YAML::VALUE => 'fox'},
'jumped over the',
{speed => 'lazy', &YAML::VALUE, 'dog'},
]
+++ yaml
---
- The
- color: brown
speed: quick
=: fox
- jumped over the
- speed: lazy
=: dog
===
+++ config
local $YAML::InlineSeries = 3
+++ perl
[
['10', '20', '30'],
['foo', 'bar'],
['thank', 'god', "it's", 'friday'],
]
+++ yaml
---
- [10, 20, 30]
- [foo, bar]
-
- thank
- god
- it's
- friday
===
+++ config
local $YAML::SortKeys = [qw(foo bar baz)]
+++ perl
{foo=>'42',bar=>'99',baz=>'4'}
+++ yaml
---
foo: 42
bar: 99
baz: 4
===
+++ perl
{foo => '42', bar => 'baz'}
+++ yaml
---
bar: baz
foo: 42
|