]> gitweb.factorcode.org Git - factor.git/commitdiff
YAML: Add tests for anchors in yaml>
authorJon Harper <jon.harper87@gmail.com>
Mon, 17 Mar 2014 20:39:14 +0000 (21:39 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 27 Apr 2014 22:24:24 +0000 (15:24 -0700)
extra/yaml/yaml-tests.factor

index 41e1c1ba9b832bbd0506d1cb948c8ce5a06e805f..3a80f104a6474197a9a47ea80bed7f4e227094eb 100644 (file)
@@ -65,6 +65,22 @@ ${ test-objs } [ $ test-docs yaml-docs> ] unit-test
 ${ test-docs } [ $ test-objs >yaml-docs ] unit-test
 ${ test-docs } [ $ test-docs yaml-docs> >yaml-docs ] unit-test
 
+! Anchors
+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" } }
+}
+
+${ test-anchors-obj } [ $ test-anchors yaml> ] unit-test
+${ test-anchors-obj } [ $ test-anchors-obj >yaml yaml> ] unit-test
+
 ! Lifted from pyyaml
 ! http://pyyaml.org/browser/pyyaml/trunk/tests/data