=== Empty double-quote
--- yaml
\---
- ""
--- perl
[ [ "" ] ]
# Simple single quote
=== single_quote1
--- yaml
---
- 'foo'
--- perl
[ [ 'foo' ] ]
=== single_spaces
--- yaml
---
- ' '
--- perl
[ [ ' ' ] ]
=== single_null
--- yaml
---
- ''
--- perl
[ [ '' ] ]
# Double quotes
=== only_spaces
--- noyamlpm
--- yaml
--- " "
--- perl
[ ' ' ]
=== leading_trailing_spaces
--- noyamlpm
--- yaml
--- " foo"
--- "bar "
--- perl
[ " foo", "bar " ]
=== single quotes in double quotes
--- yaml
\--- "'foo'"
--- perl
[ "'foo'" ]
=== double quotes in single quotes
--- yaml
\--- '"foo"'
--- perl
[ '"foo"' ]
#####################################################################
# Quote vs Hash
=== hash-like quote
--- yaml
---
author:
- 'mst: Matt S. Trout <mst@shadowcatsystems.co.uk>'
--- perl
[ { author => [ 'mst: Matt S. Trout <mst@shadowcatsystems.co.uk>' ] } ]
#####################################################################
# Quote and Escaping Idiosyncracies
=== single quote subtleties
--- yaml
---
name1: 'O''Reilly'
name2: 'O''Reilly O''Tool'
name3: 'Double '''' Quote'
--- perl
[ {
name1 => "O'Reilly",
name2 => "O'Reilly O'Tool",
name3 => "Double '' Quote",
} ]
=== single quote subtleties
--- yaml
---
slash1: '\\'
slash2: '\\foo'
slash3: '\\foo\\\\'
--- perl
[ {
slash1 => "\\\\",
slash2 => "\\\\foo",
slash3 => "\\\\foo\\\\\\\\",
} ]
#####################################################################
# Check Multiple-Escaping
# RT #42119: write of two single quotes
=== Multiple escaping of quote ok
--- yaml
--- "A'B'C"
--- perl
[ "A'B'C" ]
# Escapes without whitespace
=== Multiple escaping of escape ok
--- yaml
\--- A\B\C
--- perl
[ "A\\B\\C" ]
# Escapes with whitespace
=== Multiple escaping of escape with whitespace ok
--- yaml
--- 'A\B \C'
--- perl
[ "A\\B \\C" ]
=== Single Dash
--- yaml
---
foo: '-'
--- perl
[ { foo => '-' } ]