Add test for choosing @id over @term when value isn't a term.
authorDave Longley <dlongley@digitalbazaar.com>
Thu, 14 Feb 2013 11:18:21 -0500
changeset 1250 e6d49334712a
parent 1249 023fbbfbbd02
child 1251 93b7adda7b04
Add test for choosing @id over @term when value isn't a term.
test-suite/tests/compact-0058-context.jsonld
test-suite/tests/compact-0058-in.jsonld
test-suite/tests/compact-0058-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0058-context.jsonld	Thu Feb 14 11:18:21 2013 -0500
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "notChosen": {"@id": "http://example.org/term", "@type": "@vocab"},
+    "chosen": {"@id": "http://example.org/term", "@type": "@id"}
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0058-in.jsonld	Thu Feb 14 11:18:21 2013 -0500
@@ -0,0 +1,3 @@
+[{
+  "http://example.org/term": [{"@id": "http://example.org/enum"}]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0058-out.jsonld	Thu Feb 14 11:18:21 2013 -0500
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "notChosen": {"@id": "http://example.org/term", "@type": "@vocab"},
+    "chosen": {"@id": "http://example.org/term", "@type": "@id"}
+  },
+  "chosen": "http://example.org/enum"
+}
--- a/test-suite/tests/compact-manifest.jsonld	Wed Feb 13 18:02:05 2013 -0500
+++ b/test-suite/tests/compact-manifest.jsonld	Thu Feb 14 11:18:21 2013 -0500
@@ -320,13 +320,13 @@
       "expect": "compact-0052-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:CompactTest"],
-      "name": "Compact to term with @type: @vocab",
+      "name": "Compact to @type: @vocab when no @type: @id term available",
       "input": "compact-0053-in.jsonld",
       "context": "compact-0053-context.jsonld",
       "expect": "compact-0053-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:CompactTest"],
-      "name": "Compact @id to term with @type: @vocab",
+      "name": "Compact to @type: @vocab and compact @id to term",
       "input": "compact-0054-in.jsonld",
       "context": "compact-0054-context.jsonld",
       "expect": "compact-0054-out.jsonld"
@@ -338,7 +338,7 @@
       "expect": "compact-0055-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:CompactTest"],
-      "name": "Prefer term with @type: @vocab",
+      "name": "Prefer @type: @vocab over @type: @id for terms",
       "input": "compact-0056-in.jsonld",
       "context": "compact-0056-context.jsonld",
       "expect": "compact-0056-out.jsonld"
@@ -348,6 +348,12 @@
       "input": "compact-0057-in.jsonld",
       "context": "compact-0057-context.jsonld",
       "expect": "compact-0057-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Prefer @type: @id over @type: @vocab for non-terms",
+      "input": "compact-0058-in.jsonld",
+      "context": "compact-0058-context.jsonld",
+      "expect": "compact-0058-out.jsonld"
     }
   ]
 }