From 081cbe12996a4a415abb579758d3732c22844335 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Wed, 18 Dec 2019 22:36:06 -0500 Subject: [PATCH] Add test for JSON literal with a context. Tests that no processing is done on a `@context`. --- tests/expand-manifest.html | 28 ++++++++++++++++++++++++++++ tests/expand-manifest.jsonld | 8 ++++++++ tests/expand/js21-in.jsonld | 12 ++++++++++++ tests/expand/js21-out.jsonld | 9 +++++++++ tests/toRdf-manifest.html | 28 ++++++++++++++++++++++++++++ tests/toRdf-manifest.jsonld | 8 ++++++++ tests/toRdf/js21-in.jsonld | 12 ++++++++++++ tests/toRdf/js21-out.nq | 1 + 8 files changed, 106 insertions(+) create mode 100644 tests/expand/js21-in.jsonld create mode 100644 tests/expand/js21-out.jsonld create mode 100644 tests/toRdf/js21-in.jsonld create mode 100644 tests/toRdf/js21-out.nq diff --git a/tests/expand-manifest.html b/tests/expand-manifest.html index cd2ed145..2e462a28 100644 --- a/tests/expand-manifest.html +++ b/tests/expand-manifest.html @@ -6472,6 +6472,34 @@

+
+Test tjs21 Expand JSON literal with @context +
+
+
+
id
+
#tjs21
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Tests expanding JSON literal with a @context.
+
input
+
+expand/js21-in.jsonld +
+
expect
+
+expand/js21-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tl001 Language map with null value
diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 239e4c6b..899e96a1 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1927,6 +1927,14 @@ "input": "expand/js20-in.jsonld", "expect": "expand/js20-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs21", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expand JSON literal with @context", + "purpose": "Tests expanding JSON literal with a @context.", + "input": "expand/js21-in.jsonld", + "expect": "expand/js21-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tl001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/js21-in.jsonld b/tests/expand/js21-in.jsonld new file mode 100644 index 00000000..85ccb0cd --- /dev/null +++ b/tests/expand/js21-in.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "ex:foo": { + "@type": "@json" + } + }, + "ex:foo": { + "@context": "ex:not:a:context", + "test": 1 + } +} diff --git a/tests/expand/js21-out.jsonld b/tests/expand/js21-out.jsonld new file mode 100644 index 00000000..8509c9cf --- /dev/null +++ b/tests/expand/js21-out.jsonld @@ -0,0 +1,9 @@ +[{ + "ex:foo": [{ + "@type": "@json", + "@value": { + "@context": "ex:not:a:context", + "test": 1 + } + }] +}] diff --git a/tests/toRdf-manifest.html b/tests/toRdf-manifest.html index 0375aca5..a6b0424b 100644 --- a/tests/toRdf-manifest.html +++ b/tests/toRdf-manifest.html @@ -6149,6 +6149,34 @@

+
+Test tjs21 Transform JSON literal with @context +
+
+
+
id
+
#tjs21
+
Type
+
jld:PositiveEvaluationTest, jld:ToRDFTest
+
Purpose
+
Tests transforming JSON literal with a @context.
+
input
+
+toRdf/js21-in.jsonld +
+
expect
+
+toRdf/js21-out.nq +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tli01 @list containing @list
diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index a4367a4b..29b57d1c 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -1876,6 +1876,14 @@ "input": "toRdf/js20-in.jsonld", "expect": "toRdf/js20-out.nq", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#tjs21", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Transform JSON literal with @context", + "purpose": "Tests transforming JSON literal with a @context.", + "input": "toRdf/js21-in.jsonld", + "expect": "toRdf/js21-out.nq", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tli01", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/js21-in.jsonld b/tests/toRdf/js21-in.jsonld new file mode 100644 index 00000000..85ccb0cd --- /dev/null +++ b/tests/toRdf/js21-in.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "ex:foo": { + "@type": "@json" + } + }, + "ex:foo": { + "@context": "ex:not:a:context", + "test": 1 + } +} diff --git a/tests/toRdf/js21-out.nq b/tests/toRdf/js21-out.nq new file mode 100644 index 00000000..eafb23e6 --- /dev/null +++ b/tests/toRdf/js21-out.nq @@ -0,0 +1 @@ +_:c14n0 "{\"@context\":\"ex:not:a:context\",\"test\":1}"^^ .