Add test for best matching compaction, fix best match in test 6.
authorDave Longley <dlongley@digitalbazaar.com>
Sat, 14 Apr 2012 21:48:36 -0400
changeset 514 1ce67e3f8570
parent 513 e879121d9b8f
child 516 fb52fd18c542
Add test for best matching compaction, fix best match in test 6.
test-suite/tests/compact-0006-out.jsonld
test-suite/tests/compact-0015-context.jsonld
test-suite/tests/compact-0015-in.jsonld
test-suite/tests/compact-0015-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- a/test-suite/tests/compact-0006-out.jsonld	Fri Apr 13 16:26:49 2012 -0700
+++ b/test-suite/tests/compact-0006-out.jsonld	Sat Apr 14 21:48:36 2012 -0400
@@ -9,6 +9,6 @@
   },
   "@id": "ex:id1",
   "@type": ["ex:Type1", "ex:Type2"],
-  "term1": {"@value": "v1", "@type": "ex:different-datatype"},
+  "ex:term1": {"@value": "v1", "@type": "ex:different-datatype"},
   "term2": {"@id": "ex:id2"}
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0015-context.jsonld	Sat Apr 14 21:48:36 2012 -0400
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "id1": "http://example.com/id1",
+    "t1": "http://example.com/t1",
+    "t2": "http://example.com/t2",
+    "term1": "http://example.com/term",
+    "term2": {"@id": "http://example.com/term", "@type": "t2"},
+    "term3": {"@id": "http://example.com/term", "@language": "en"},
+    "term4": {"@id": "http://example.com/term", "@container": "@list"},
+    "term5": {"@id": "http://example.com/term", "@language": null},
+    "@language": "de"
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0015-in.jsonld	Sat Apr 14 21:48:36 2012 -0400
@@ -0,0 +1,11 @@
+[{
+  "@id": "http://example.com/id1",
+  "@type": ["http://example.com/t1"],
+  "http://example.com/term": [
+    "v1",
+    {"@value": "v2", "@type": "http://example.com/t2"},
+    {"@value": "v3", "@language": "en"},
+    {"@list": [1, 2]},
+    {"@value": "plain literal"}
+  ]
+}]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0015-out.jsonld	Sat Apr 14 21:48:36 2012 -0400
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "id1": "http://example.com/id1",
+    "t1": "http://example.com/t1",
+    "t2": "http://example.com/t2",
+    "term1": "http://example.com/term",
+    "term2": {"@id": "http://example.com/term", "@type": "t2"},
+    "term3": {"@id": "http://example.com/term", "@language": "en"},
+    "term4": {"@id": "http://example.com/term", "@container": "@list"},
+    "term5": {"@id": "http://example.com/term", "@language": null},
+    "@language": "de"
+  },
+  "@id": "id1",
+  "@type": "t1",
+  "term5": ["v1", "plain literal"],
+  "term2": "v2",
+  "term3": "v3",
+  "term4": [1, 2]
+}
--- a/test-suite/tests/compact-manifest.jsonld	Fri Apr 13 16:26:49 2012 -0700
+++ b/test-suite/tests/compact-manifest.jsonld	Sat Apr 14 21:48:36 2012 -0400
@@ -89,5 +89,11 @@
     "input": "compact-0014-in.jsonld",
     "context": "compact-0014-context.jsonld",
     "expect": "compact-0014-out.jsonld"
+  }, {
+    "@type": ["test:TestCase", "jld:CompactTest"],
+    "name": "best match compaction",
+    "input": "compact-0015-in.jsonld",
+    "context": "compact-0015-context.jsonld",
+    "expect": "compact-0015-out.jsonld"
   }]
 }