xref: /openbsd-src/gnu/usr.bin/perl/cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/comment.tml (revision 6fb12b7054efc6b436584db6cef9c2f85c0d7e27)
1#####################################################################
2# Main Tests
3
4=== Properly ignore comments
5--- yaml
6---
7a: b#content
8c: d #comment
9e:
10- f #comment
11- g# content
12h: 'single'                 # comment
13h2: 'single # content'      # comment
14i: "double"                 # comment
15i2: "double # content"      # comment
16j: |        # comment
17    literal # content
18    block   # content
19k: {}       # comment
20l: []       # comment
21m:      # comment
22  n: o
23--- perl
24[
25    {
26        a => 'b#content',
27        c => 'd',
28        e => [
29            'f',
30            'g# content',
31        ],
32        h => 'single',
33        h2 => 'single # content',
34        i => 'double',
35        i2 => 'double # content',
36        j => "literal # content\nblock   # content\n",
37        k => {},
38        l => [],
39        m => {
40            n => 'o',
41        },
42    },
43]
44--- noyamlpm
45
46
47# Repeat, with otherwise illegal characters in the comments
48=== Properly ignore comments (with otherwise illegal characters)
49--- yaml
50---
51a: b#content
52c: d #comment '"!&@%`
53e:
54- f #comment '"!&@%`
55- g# content
56h: 'single'                 # comment '"!&@%`
57h2: 'single # content'      # comment '"!&@%`
58i: "double"                 # comment '"!&@%`
59i2: "double # content"      # comment '"!&@%`
60j: |        # comment '"!&@%`
61    literal # content
62    block   # content
63k: {}       # comment '"!&@%`
64l: []       # comment '"!&@%`
65m:      # comment '"!&@%`
66  n: o
67--- perl
68[
69    {
70        a => 'b#content',
71        c => 'd',
72        e => [
73            'f',
74            'g# content',
75        ],
76        h => 'single',
77        h2 => 'single # content',
78        i => 'double',
79        i2 => 'double # content',
80        j => "literal # content\nblock   # content\n",
81        k => {},
82        l => [],
83        m => {
84            n => 'o',
85        },
86    },
87]
88--- noyamlpm
89
90####################################################################
91# Comment on the Document Line
92
93=== comment header
94--- yaml
95--- # Comment
96foo: bar
97--- perl
98[ { foo => 'bar' } ]
99--- noyamlpm
100
101
102# Empty comments
103=== empty_comment_in_list
104--- yaml
105---
106- foo
107\#
108- bar
109
110--- perl
111[ [ 'foo', 'bar' ] ]
112
113
114=== empty_comment_in_hash
115--- yaml
116---
117foo: bar
118\# foo
119one: two
120
121--- perl
122[ { foo => 'bar', one => 'two' } ]
123
124
125