Debian Codegraph @

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

raw
1 === Empty double-quote
2 --- yaml
3 \---
4 - ""
5 --- perl
6 [ [ "" ] ]
7
8 # Simple single quote
9 === single_quote1
10 --- yaml
11 ---
12 - 'foo'
13
14 --- perl
15 [ [ 'foo' ] ]
16
17
18 === single_spaces
19 --- yaml
20 ---
21 - ' '
22 --- perl
23 [ [ ' ' ] ]
24
25
26 === single_null
27 --- yaml
28 ---
29 - ''
30
31 --- perl
32 [ [ '' ] ]
33
34
35 # Double quotes
36 === only_spaces
37 --- noyamlpm
38 --- yaml
39 --- " "
40
41 --- perl
42 [ ' ' ]
43
44
45 === leading_trailing_spaces
46 --- noyamlpm
47 --- yaml
48 --- " foo"
49 --- "bar "
50
51 --- perl
52 [ " foo", "bar " ]
53
54 === single quotes in double quotes
55 --- yaml
56 \--- "'foo'"
57 --- perl
58 [ "'foo'" ]
59
60 === double quotes in single quotes
61 --- yaml
62 \--- '"foo"'
63 --- perl
64 [ '"foo"' ]
65
66 #####################################################################
67 # Quote vs Hash
68
69 === hash-like quote
70 --- yaml
71 ---
72 author:
73 - 'mst: Matt S. Trout <[email protected]>'
74 --- perl
75 [ { author => [ 'mst: Matt S. Trout <[email protected]>' ] } ]
76
77 #####################################################################
78 # Quote and Escaping Idiosyncracies
79
80 === single quote subtleties
81 --- yaml
82 ---
83 name1: 'O''Reilly'
84 name2: 'O''Reilly O''Tool'
85 name3: 'Double '''' Quote'
86 --- perl
87 [ {
88 name1 => "O'Reilly",
89 name2 => "O'Reilly O'Tool",
90 name3 => "Double '' Quote",
91 } ]
92
93
94 === single quote subtleties
95 --- yaml
96 ---
97 slash1: '\\'
98 slash2: '\\foo'
99 slash3: '\\foo\\\\'
100 --- perl
101 [ {
102 slash1 => "\\\\",
103 slash2 => "\\\\foo",
104 slash3 => "\\\\foo\\\\\\\\",
105 } ]
106
107 #####################################################################
108 # Check Multiple-Escaping
109
110 # RT #42119: write of two single quotes
111 === Multiple escaping of quote ok
112 --- yaml
113 --- "A'B'C"
114 --- perl
115 [ "A'B'C" ]
116
117
118 # Escapes without whitespace
119 === Multiple escaping of escape ok
120 --- yaml
121 \--- A\B\C
122 --- perl
123 [ "A\\B\\C" ]
124
125
126 # Escapes with whitespace
127 === Multiple escaping of escape with whitespace ok
128 --- yaml
129 --- 'A\B \C'
130 --- perl
131 [ "A\\B \\C" ]
132
133
134 === Single Dash
135 --- yaml
136 ---
137 foo: '-'
138 --- perl
139 [ { foo => '-' } ]