]> gitweb.factorcode.org Git - factor.git/commitdiff
YAML: add simple tests for >yaml and >yaml
authorJon Harper <jon.harper87@gmail.com>
Sun, 2 Feb 2014 12:24:21 +0000 (13:24 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 27 Apr 2014 22:24:22 +0000 (15:24 -0700)
extra/yaml/yaml-tests.factor [new file with mode: 0644]

diff --git a/extra/yaml/yaml-tests.factor b/extra/yaml/yaml-tests.factor
new file mode 100644 (file)
index 0000000..b203c86
--- /dev/null
@@ -0,0 +1,37 @@
+! Copyright (C) 2014 Jon Harper.
+! See http://factorcode.org/license.txt for BSD license.
+USING: literals tools.test yaml ;
+IN: yaml.tests
+
+! TODO real conformance tests here
+
+CONSTANT: test-string """--- # Favorite movies
+ - Casablanca
+ - North by Northwest
+ - The Man Who Wasn't There
+ - last:
+   - 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
+- !!str Casablanca
+- !!str North by Northwest
+- !!str The Man Who Wasn't There
+- !!map
+  !!str last: !!seq
+  - !!str foo
+  - !!str bar
+  - !!str baz
+...
+"""
+
+${ test-obj } [ $ test-string yaml> ] unit-test
+${ test-represented-string } [ $ test-obj >yaml ] unit-test
+${ test-represented-string } [ $ test-represented-string yaml> >yaml ] unit-test