Debian Codegraph @

cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/comment.tml

raw
1 #####################################################################
2 # Main Tests
3
4 === Properly ignore comments
5 --- yaml
6 ---
7 a: b#content
8 c: d #comment
9 e:
10 - f #comment
11 - g# content
12 h: 'single' # comment
13 h2: 'single # content' # comment
14 i: "double" # comment
15 i2: "double # content" # comment
16 j: | # comment
17 literal # content
18 block # content
19 k: {} # comment
20 l: [] # comment
21 m: # 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 ---
51 a: b#content
52 c: d #comment '"!&@%`
53 e:
54 - f #comment '"!&@%`
55 - g# content
56 h: 'single' # comment '"!&@%`
57 h2: 'single # content' # comment '"!&@%`
58 i: "double" # comment '"!&@%`
59 i2: "double # content" # comment '"!&@%`
60 j: | # comment '"!&@%`
61 literal # content
62 block # content
63 k: {} # comment '"!&@%`
64 l: [] # comment '"!&@%`
65 m: # 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
96 foo: 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 ---
117 foo: bar
118 \# foo
119 one: two
120
121 --- perl
122 [ { foo => 'bar', one => 'two' } ]
123
124