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

filters {
    yaml => [yaml => 'dumper'],
    perl => [strict => eval => 'dumper'],
};

run_is yaml => 'perl';

__END__
=== A simple map
+++ yaml
---
one: foo
two: bar
three: baz
+++ perl
+{qw(one foo two bar three baz)}


=== Common String Types
+++ yaml
---
one: simple string
two: 42
three: '1 Single Quoted String'
four: "YAML's Double Quoted String"
five: |
  A block
    with several
      lines.
six: |-
  A "chomped" block
seven: >
  A
  folded
   string
+++ perl
{
    one => "simple string",
    two => '42',
    three => "1 Single Quoted String",
    four => "YAML's Double Quoted String",
    five => "A block\n  with several\n    lines.\n",
    six => 'A "chomped" block',
    seven => "A folded\n string\n",
}


=== Multiple documents
+++ yaml
---
foo: bar
---
bar: two
+++ perl
+{qw(foo bar)}, {qw(bar two)};


=== Comments
+++ yaml
# Leading Comment
---
# Preceding Comment
foo: bar
# Two
# Comments
---
    # Indented comment
bar: two
bee: three
# Intermediate comment
bore: four
+++ perl
+{qw(foo bar)}, {qw(bar two bee three bore four)}