]> gitweb.factorcode.org Git - factor.git/commitdiff
YAML: correctly emit f as "!!bool false"
authorJon Harper <jon.harper87@gmail.com>
Fri, 4 Apr 2014 19:10:32 +0000 (21:10 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 27 Apr 2014 22:24:25 +0000 (15:24 -0700)
extra/yaml/yaml-tests.factor
extra/yaml/yaml.factor

index 55d9ed8a225f793089ff626f1858bd38e1f97b20..66b843c7c8932cdf9527dfffdcfe317448ec892e 100644 (file)
@@ -65,6 +65,20 @@ ${ 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
 
+! Misc types
+CONSTANT: test-types { 1 t f 1.0 }
+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"
 - *1
index f2d97e1937bb3965f019cce933eee66ee13aecf6..fcb191edf5133439e5d22b1ec0fe6b1c1abcf9d7 100644 (file)
@@ -207,6 +207,7 @@ M: object emit-value ( emitter event obj -- ) emit-scalar ;
 : emit-set ( emitter event set -- )
     [ members ] [ cardinality f <array> ] bi zip concat emit-sequence ;
 
+M: f emit-value ( emitter event seq -- ) emit-scalar ;
 M: string emit-value ( emitter event seq -- ) emit-scalar ;
 M: byte-array emit-value ( emitter event seq -- ) emit-scalar ;
 M: sequence emit-value ( emitter event seq -- )