]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/yaml/yaml-tests.factor
factor: remove """ string syntax for now. there are HEREDOC:, STRING:, escaping ...
[factor.git] / extra / yaml / yaml-tests.factor
index cf9169f6ef956dd3cc9eab9859fb594544cfd619..70b2967fa652537d8f515b1445cb012363b8ff78 100644 (file)
@@ -18,7 +18,7 @@ f implicit-end set
 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
@@ -26,14 +26,14 @@ CONSTANT: test-string """--- # Favorite movies
    - 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
@@ -43,7 +43,7 @@ CONSTANT: test-represented-string """--- !!seq
   - !!str bar
   - !!str baz
 ...
-"""
+"
 
 ${ test-obj } [ $ test-string yaml> ] unit-test
 ${ test-represented-string } [ $ test-obj >yaml ] unit-test
@@ -51,17 +51,17 @@ ${ test-represented-string } [ $ test-represented-string yaml> >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
@@ -70,7 +70,7 @@ CONSTANT: test-docs """--- !!str a
 --- !!map
 !!str d: !!str e
 ...
-"""
+"
 CONSTANT: test-objs { "a" { "b" "c" } H{ { "d" "e" } } }
 
 ${ test-objs } [ $ test-docs yaml-docs> ] unit-test
@@ -79,27 +79,27 @@ ${ test-docs } [ $ test-docs yaml-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" } }
 }
@@ -111,11 +111,11 @@ ${ test-anchors-obj } [ $ test-anchors-obj >yaml yaml> ] unit-test
 { 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" } }
 }
@@ -128,8 +128,8 @@ ${ fancy-anchors-obj } [ $ fancy-anchors-obj >yaml yaml> ] unit-test
 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
@@ -176,7 +176,7 @@ ${ transitive-recursive-objects-anchored } [ transitive-recursive-objects replac
 !     { "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
@@ -185,7 +185,7 @@ ${ transitive-recursive-objects-anchored } [ transitive-recursive-objects replac
 ! 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
@@ -202,13 +202,13 @@ ${ transitive-recursive-objects-anchored } [ transitive-recursive-objects replac
 !     { "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
@@ -224,13 +224,13 @@ CONSTANT: construct-map-obj H{ {
     }
 }
 
-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
@@ -253,7 +253,7 @@ CONSTANT: construct-null-obj {
 }
 
 
-CONSTANT: construct-null-str """# A document may be null.
+CONSTANT: construct-null-str "# A document may be null.
 ---
 ---
 # This mapping has four keys,
@@ -271,7 +271,7 @@ sparse:
   -
   - 4th entry
   - Null
-"""
+"
 
 ${ construct-null-obj } [ $ construct-null-str yaml-docs> ] unit-test
 ! TODO Decide what to do with null -> f -> false
@@ -284,7 +284,7 @@ CONSTANT: construct-seq-obj H{
     { "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.
@@ -298,7 +298,7 @@ Block style: !!seq
 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
@@ -321,14 +321,14 @@ CONSTANT: construct-set-obj H{
   }
 }
 
-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
@@ -384,11 +384,11 @@ CONSTANT: construct-binary-obj H{
   }
 }
 
-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/+
@@ -396,7 +396,7 @@ generic: !!binary |
  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
@@ -430,7 +430,7 @@ CONSTANT: construct-merge-obj {
     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 }
@@ -457,7 +457,7 @@ CONSTANT: construct-merge-str """---
   << : [ *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
@@ -551,7 +551,7 @@ CONSTANT: construct-omap-obj H{
   }
 }
 
-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.
@@ -559,7 +559,7 @@ Bestiary: !!omap
   # 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
@@ -581,14 +581,14 @@ CONSTANT: construct-pairs-obj H{
   }
 }
 
-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{
   {
@@ -676,13 +676,13 @@ CONSTANT: construct-timestamp-obj 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
@@ -703,7 +703,7 @@ CONSTANT: construct-value-safe-obj {
     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
@@ -713,7 +713,7 @@ link with:
     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
@@ -773,25 +773,25 @@ t implicit-end set
 ! 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
 
 {