Add test case for relative IRI normalization w/empty @base.
authorDave Longley <dlongley@digitalbazaar.com>
Tue, 05 Mar 2013 17:30:17 -0500
changeset 1374 1b51406761a2
parent 1373 76ea63da4a94
child 1375 62c32b280fcc
Add test case for relative IRI normalization w/empty @base.
test-suite/tests/expand-0062-in.jsonld
test-suite/tests/expand-0062-out.jsonld
test-suite/tests/expand-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0062-in.jsonld	Tue Mar 05 17:30:17 2013 -0500
@@ -0,0 +1,35 @@
+{
+  "@context": {
+    "@base": "",
+    "links": { "@id": "http://www.example.com/link", "@type": "@id", "@container": "@list" }
+  },
+  "@id": "relativeIris",
+  "@type": [
+    "link",
+    "#fragment-works",
+    "?query=works",
+    "./",
+    "../",
+    "../parent",
+    "../../parent-parent-eq-root",
+    "../../../../../still-root",
+    "../.././.././../../too-many-dots",
+    "/absolute",
+    "//example.org/scheme-relative"
+  ],
+  "links": [
+    "link",
+    "#fragment-works",
+    "?query=works",
+    "./",
+    "../",
+    "../parent",
+    "../../parent-parent-eq-root",
+    "./../../../../../still-root",
+    "../.././.././../../too-many-dots",
+    "/absolute",
+    "//example.org/scheme-relative",
+    "//example.org/../scheme-relative",
+    "//example.org/.././useless/../../scheme-relative"
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0062-out.jsonld	Tue Mar 05 17:30:17 2013 -0500
@@ -0,0 +1,35 @@
+[
+  {
+    "@id": "relativeIris",
+    "@type": [
+        "link",
+        "#fragment-works",
+        "?query=works",
+        "./",
+        "../",
+        "../parent",
+        "../../parent-parent-eq-root",
+        "../../../../../still-root",
+        "../../../../../too-many-dots",
+        "/absolute",
+        "//example.org/scheme-relative"
+    ],
+    "http://www.example.com/link": [ {
+      "@list": [
+        { "@id": "link" },
+        { "@id": "#fragment-works" },
+        { "@id": "?query=works" },
+        { "@id": "./" },
+        { "@id": "../" },
+        { "@id": "../parent" },
+        { "@id": "../../parent-parent-eq-root" },
+        { "@id": "../../../../../still-root" },
+        { "@id": "../../../../../too-many-dots" },
+        { "@id": "/absolute" },
+        { "@id": "//example.org/scheme-relative" },
+        { "@id": "//example.org/scheme-relative" },
+        { "@id": "//example.org/scheme-relative" }
+      ]
+    } ]
+  }
+]
--- a/test-suite/tests/expand-manifest.jsonld	Tue Mar 05 20:21:07 2013 +0100
+++ b/test-suite/tests/expand-manifest.jsonld	Tue Mar 05 17:30:17 2013 -0500
@@ -313,6 +313,11 @@
       "name": "Set @base to an empty string",
       "input": "expand-0061-in.jsonld",
       "expect": "expand-0061-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Relative IRIs with empty @base",
+      "input": "expand-0062-in.jsonld",
+      "expect": "expand-0062-out.jsonld"
     }
   ]
 }