t emitter-unicode set
! Basic test
-CONSTANT: test-string """--- # Favorite movies
+CONSTANT: test-string "--- # Favorite movies
- Casablanca
- North by Northwest
- The Man Who Wasn't There
- foo
- bar
- baz
-"""
+"
CONSTANT: test-obj {
"Casablanca"
"North by Northwest"
"The Man Who Wasn't There"
H{ { "last" { "foo" "bar" "baz" } } }
}
-CONSTANT: test-represented-string """--- !!seq
+CONSTANT: test-represented-string "--- !!seq
- !!str Casablanca
- !!str North by Northwest
- !!str The Man Who Wasn't There
- !!str bar
- !!str baz
...
-"""
+"
${ test-obj } [ $ test-string yaml> ] unit-test
${ test-represented-string } [ $ test-obj >yaml ] unit-test
! Non-scalar key
CONSTANT: complex-key H{ { { "foo" } "bar" } }
-CONSTANT: complex-key-represented """--- !!map
+CONSTANT: complex-key-represented "--- !!map
? !!seq
- !!str foo
: !!str bar
...
-"""
+"
${ complex-key } [ $ complex-key-represented yaml> ] unit-test
! Multiple docs
-CONSTANT: test-docs """--- !!str a
+CONSTANT: test-docs "--- !!str a
...
--- !!seq
- !!str b
--- !!map
!!str d: !!str e
...
-"""
+"
CONSTANT: test-objs { "a" { "b" "c" } H{ { "d" "e" } } }
${ test-objs } [ $ test-docs yaml-docs> ] unit-test
! Misc types
CONSTANT: test-types { 1 t f 1.0 }
-CONSTANT: test-represented-types """--- !!seq
+CONSTANT: test-represented-types "--- !!seq
- !!int 1
- !!bool true
- !!bool false
- !!float 1.0
...
-"""
+"
${ test-types } [ $ test-represented-types yaml> ] unit-test
${ test-types } [ $ test-types >yaml yaml> ] unit-test
! Anchors
-CONSTANT: test-anchors """- &1 "1"
+CONSTANT: test-anchors "- &1 \"1\"
- *1
- &2 ["1","2"]
- *2
- &3
*1 : "one"
- *3
-"""
+"
CONSTANT: test-anchors-obj {
"1" "1" { "1" "2" } { "1" "2" } H{ { "1" "one" } } H{ { "1" "one" } }
}
{ t } [ $ test-anchors yaml> >yaml yaml> 2 group [ all-eq? ] all? ] unit-test
! Anchors and fancy types
-CONSTANT: fancy-anchors """- &1 [ "foo" ]
+CONSTANT: fancy-anchors "- &1 [ \"foo\" ]
- &2 !!set
? *1
- *2
-"""
+"
CONSTANT: fancy-anchors-obj {
{ "foo" } HS{ { "foo" } } HS{ { "foo" } }
}
CONSTANT: simple-recursive-list-anchored T{ yaml-anchor f "0" {
T{ yaml-alias f "0" }
} }
-CONSTANT: simple-recursive-list-yaml """&0
-- *0"""
+CONSTANT: simple-recursive-list-yaml "&0
+- *0"
${ simple-recursive-list-anchored } [ simple-recursive-list replace-identities ] unit-test
${ simple-recursive-list-anchored } [ $ simple-recursive-list-yaml yaml> replace-identities ] unit-test
! { "but" H{ { "y" "is a string" } { "n" "is a string" } } }
! }
!
-! CONSTANT: construct-bool-str """canonical: yes
+! CONSTANT: construct-bool-str "canonical: yes
! answer: NO
! logical: True
! option: on
! but:
! y: is a string
! n: is a string
-! """
+! "
!
! ${ construct-bool-obj } [ $ construct-bool-str yaml> ] unit-test
! ${ construct-bool-obj } [ $ construct-bool-obj >yaml yaml> ] unit-test
! { "binary" 685230 }
! { "sexagesimal" 685230 }
! }
-! CONSTANT: construct-int-str """canonical: 685230
+! CONSTANT: construct-int-str "canonical: 685230
! decimal: +685_230
! octal: 02472256
! hexadecimal: 0x_0A_74_AE
! binary: 0b1010_0111_0100_1010_1110
! sexagesimal: 190:20:30
-! """
+! "
!
! ${ construct-int-obj } [ $ construct-int-str yaml> ] unit-test
! ${ construct-int-obj } [ $ construct-int-obj >yaml yaml> ] unit-test
}
}
-CONSTANT: construct-map-str """# Unordered set of key: value pairs.
+CONSTANT: construct-map-str "# Unordered set of key: value pairs.
Block style: !!map
Clark : Evans
Brian : Ingerson
Oren : Ben-Kiki
Flow style: !!map { Clark: Evans, Brian: Ingerson, Oren: Ben-Kiki }
-"""
+"
${ construct-map-obj } [ $ construct-map-str yaml> ] unit-test
${ construct-map-obj } [ $ construct-map-obj >yaml yaml> ] unit-test
}
-CONSTANT: construct-null-str """# A document may be null.
+CONSTANT: construct-null-str "# A document may be null.
---
---
# This mapping has four keys,
-
- 4th entry
- Null
-"""
+"
${ construct-null-obj } [ $ construct-null-str yaml-docs> ] unit-test
! TODO Decide what to do with null -> f -> false
{ "Flow style" { "Mercury" "Venus" "Earth" "Mars" "Jupiter" "Saturn" "Uranus" "Neptune" "Pluto" } }
}
-CONSTANT: construct-seq-str """# Ordered sequence of nodes
+CONSTANT: construct-seq-str "# Ordered sequence of nodes
Block style: !!seq
- Mercury # Rotates - no light/dark sides.
- Venus # Deadliest. Aptly named.
Flow style: !!seq [ Mercury, Venus, Earth, Mars, # Rocks
Jupiter, Saturn, Uranus, Neptune, # Gas
Pluto ] # Overrated
-"""
+"
${ construct-seq-obj } [ $ construct-seq-str yaml> ] unit-test
${ construct-seq-obj } [ $ construct-seq-obj >yaml yaml> ] unit-test
}
}
-CONSTANT: construct-set-str """# Explicitly typed set.
+CONSTANT: construct-set-str "# Explicitly typed set.
baseball players: !!set
? Mark McGwire
? Sammy Sosa
? Ken Griffey
# Flow style
baseball teams: !!set { Boston Red Sox, Detroit Tigers, New York Yankees }
-"""
+"
${ construct-set-obj } [ $ construct-set-str yaml> ] unit-test
${ construct-set-obj } [ $ construct-set-obj >yaml yaml> ] unit-test
}
}
-CONSTANT: construct-binary-str """canonical: !!binary "\\
+CONSTANT: construct-binary-str "canonical: !!binary \"\\
R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\\
OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\\
+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\\
- AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
+ AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=\"
generic: !!binary |
R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
description:
The binary value above is a tiny arrow encoded as a gif image.
-"""
+"
${ construct-binary-obj } [ $ construct-binary-str yaml> ] unit-test
${ construct-binary-obj } [ $ construct-binary-obj >yaml yaml> ] unit-test
H{ { T{ yaml-merge } { BIG LEFT SMALL } } { "x" 1 } { "label" "center/big" } }
} ;
-CONSTANT: construct-merge-str """---
+CONSTANT: construct-merge-str "---
- &CENTER { x: 1, 'y': 2 }
- &LEFT { x: 0, 'y': 2 }
- &BIG { r: 10 }
<< : [ *BIG, *LEFT, *SMALL ]
x: 1
label: center/big
-"""
+"
${ construct-merge-obj } [ $ construct-merge-str yaml> ] unit-test
${ construct-merge-obj } [ $ construct-merge-obj2 >yaml yaml> ] unit-test
}
}
-CONSTANT: construct-omap-str """# Explicitly typed ordered map (dictionary).
+CONSTANT: construct-omap-str "# Explicitly typed ordered map (dictionary).
Bestiary: !!omap
- aardvark: African pig-like ant eater. Ugly.
- anteater: South-American ant eater. Two species.
# Etc.
# Flow style
Numbers: !!omap [ one: 1, two: 2, three : 3 ]
-"""
+"
${ construct-omap-obj } [ $ construct-omap-str yaml> ] unit-test
${ construct-omap-obj } [ construct-omap-obj >yaml yaml> ] unit-test
}
}
-CONSTANT: construct-pairs-str """# Explicitly typed pairs.
+CONSTANT: construct-pairs-str "# Explicitly typed pairs.
Block tasks: !!pairs
- meeting: with team.
- meeting: with boss.
- break: lunch.
- meeting: with client.
Flow tasks: !!pairs [ meeting: with team, meeting: with boss ]
-"""
+"
CONSTANT: construct-pairs-obj-roundtripped H{
{
}
}
}
-CONSTANT: construct-timestamp-str """canonical: 2001-12-15T02:59:43.1Z
+CONSTANT: construct-timestamp-str "canonical: 2001-12-15T02:59:43.1Z
valid iso8601: 2001-12-14t21:59:43.10-05:00
space separated: 2001-12-14 21:59:43.10 -5
no time zone (Z): 2001-12-15 2:59:43.10
date (00:00:00Z): 2002-12-14
crazy: 2002-2-4 \t\t \t 1:02:59.123 \t\t +10:23
-"""
+"
${ construct-timestamp-obj } [ $ construct-timestamp-str yaml> ] unit-test
${ construct-timestamp-obj } [ $ construct-timestamp-obj >yaml yaml> ] unit-test
H{ { "link with" { "library1.dll" "library2.dll" } } }
}
-CONSTANT: construct-value-str """--- # Old schema
+CONSTANT: construct-value-str "--- # Old schema
link with:
- library1.dll
- library2.dll
version: 1.2
- = : library2.dll
version: 2.3
-"""
+"
${ construct-value-safe-obj } [ $ construct-value-str yaml-docs> ] unit-test
${ construct-value-safe-obj } [ $ construct-value-safe-obj >yaml-docs yaml-docs> ] unit-test
! unicode off
f emitter-unicode
[
-{ """- Hello
-- "Gr\\xFC\\xDF dich"
-- "\\u0437\\u0434\\u0440\\u0430\\u0432\\u0441\\u0442\\u0432\\u0443\\u0439\\u0442\\u0435"
-- "\\u3053\\u3093\\u306B\\u3061\\u306F"
-- "\\uC548\\uB155\\uD558\\uC138\\uC694"
-- "\\u05E9\\u05B8\\u05C1\\u05DC\\u05D5\\u05B9\\u05DD "
-- "\\u10D2\\u10D0\\u10DB\\u10D0\\u10E0\\u10EF\\u10DD\\u10D1\\u10D0"
-""" } [ { "Hello" "Grüß dich" "здравствуйте" "こんにちは" "안녕하세요" "שָׁלוֹם " "გამარჯობა" } >yaml ] unit-test
+{ "- Hello
+- \"Gr\\xFC\\xDF dich\"
+- \"\\u0437\\u0434\\u0440\\u0430\\u0432\\u0441\\u0442\\u0432\\u0443\\u0439\\u0442\\u0435\"
+- \"\\u3053\\u3093\\u306B\\u3061\\u306F\"
+- \"\\uC548\\uB155\\uD558\\uC138\\uC694\"
+- \"\\u05E9\\u05B8\\u05C1\\u05DC\\u05D5\\u05B9\\u05DD \"
+- \"\\u10D2\\u10D0\\u10DB\\u10D0\\u10E0\\u10EF\\u10DD\\u10D1\\u10D0\"
+" } [ { "Hello" "Grüß dich" "здравствуйте" "こんにちは" "안녕하세요" "שָׁלוֹם " "გამარჯობა" } >yaml ] unit-test
] with-variable
! canonical
t emitter-canonical [
-{ """---
+{ "---
!!seq [
- !!int "1",
- !!float "2.0",
- !!bool "false",
+ !!int \"1\",
+ !!float \"2.0\",
+ !!bool \"false\",
]
-""" } [ { 1 2.0 f } >yaml ] unit-test
+" } [ { 1 2.0 f } >yaml ] unit-test
] with-variable
{