summaryrefslogtreecommitdiff
path: root/t/dump-basics.t
blob: 7c829dc49eb27c8fbff4bbf1136bba43b43ccbd0 (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
use strict;
use lib -e 't' ? 't' : 'test';
use TestYAML tests => 7;

filters {
    perl => [qw'eval yaml_dump'],
};

run_is;

__DATA__
=== A map
+++ perl
+{ foo => 'bar', baz => 'boo' }
+++ yaml
---
baz: boo
foo: bar

=== A list
+++ perl
[ qw'foo bar baz' ]
+++ yaml
---
- foo
- bar
- baz

=== A List of maps
+++ perl
[{ foo => 42, bar => 44}, {one => 'two', three => 'four'}]
+++ yaml
---
- bar: 44
  foo: 42
- one: two
  three: four

=== A map of lists
+++ perl
+{numbers => [ 5..7 ], words => [qw'five six seven']}
+++ yaml
---
numbers:
  - 5
  - 6
  - 7
words:
  - five
  - six
  - seven

=== Top level scalar
+++ perl: 'The eagle has landed'
+++ yaml
--- The eagle has landed

=== Top level literal scalar
+++ perl
<<'...'
sub foo {
    return "Don't eat the foo";
}
...
+++ yaml
--- |
sub foo {
    return "Don't eat the foo";
}

=== Single Dash
+++ perl: {foo => '-'}
+++ yaml
---
foo: '-'