CPAN-Meta-YAML
view release on metacpan or search on metacpan
t/tml-spec/unicode.tml view on Meta::CPAN
# Test unicode strings in key and value contexts
%TestML 0.1.0
###
# These tests target unicode characters that are handled special or known to be
# problematic. Test YNY (YAMLâNativeâYAML) and NYN roundtripping.
#
# YAML scalar emission does quoting based on first character, presence of
# escape characters, and special ambiguous cases like ': '. These ones
# character strings go a long way towards making sure an implementation is
# correct.
###
# Make a mapping { "$code" : "$code" } where code is a unicode code point:
# Dump mapping matches *yaml
*code.dump_code_key_value == *yaml
# Load *yaml then dump matches *yaml
*yaml.load_yaml.dump_yaml == *yaml
# Dump mapping the load memory-matches mapping
*code.code_key_value.dump_yaml.load_yaml === *code.code_key_value
# 0 â \0 "null"
#
# \z is the other YAML "null" encoding. Most implementations (including
# libyaml), seem to go with \0 when emitting.
=== Code point 0
--- code: 0
--- yaml
"\0": "\0"
# 1-6,14-27,29-31 â \x##
=== Code point 1
--- code: 1
--- yaml
"\x01": "\x01"
# 7 â \a "bell" (alarm)
=== Code point 7
--- code: 7
--- yaml
"\a": "\a"
# 8 â \b "backspace"
=== Code point 8
--- code: 8
--- yaml
"\b": "\b"
# 9 â \t "horizontal tab"
=== Code point 9
--- code: 9
--- yaml
"\t": "\t"
# 10 â \n "linefeed" (newline)
=== Code point 10
--- code: 10
--- yaml
"\n": "\n"
# 11 â \v "vertical tab"
=== Code point 11
--- code: 11
--- yaml
t/tml-spec/unicode.tml view on Meta::CPAN
--- yaml
'{': '{'
# | is a literal scalar indicator. Needs quotes.
=== Code point 124
--- code: 124
--- yaml
'|': '|'
# } is a flow mapping end indicator. Needs quotes.
=== Code point 125
--- code: 125
--- yaml
'}': '}'
# A single ~ has long been used as a plain scalar representation of null. This
# should be deprecated, but may take a while.
=== Code point 126
--- code: 126
--- yaml
'~': '~'
--- unquoted
~: ~
# 127 â "escape"
# YAML does not have a special character. YAML2 should consider \?.
=== Code point 127
--- code: 127
--- yaml
"\x7F": "\x7F"
# 80-84,86-159 â \x##
=== Code point 128
--- code: 128
--- yaml
"\x80": "\x80"
# 133 (\x85) â "next line" (NEL)
=== Code point 133
--- code: 133
--- yaml
"\N": "\N"
# 160 (\xA0) â "non-breaking space"
# It seems extremely odd that YAML does not escape this.
# Investigate further.
=== Code point 160
--- SKIP
--- code: 160
--- yaml
 : Â
# 161-⦠â From here on up use printable unicode chars.
# XXX Need to look into other special code blocks. Especially those known to
# libyaml.
=== Code point 161
--- code: 161
--- yaml
¡: ¡
( run in 0.599 second using v1.01-cache-2.11-cpan-39bf76dae61 )