Skip to content

Commit 0319468

Browse files
davidlehngkellogg
authored andcommitted
Add test for JSON literal with a context.
Tests that no processing is done on a `@context`.
1 parent 781f583 commit 0319468

File tree

8 files changed

+106
-0
lines changed

8 files changed

+106
-0
lines changed

tests/expand-manifest.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6472,6 +6472,34 @@ <h2>
64726472
</dd>
64736473
</dl>
64746474
</dd>
6475+
<dt id='tjs21'>
6476+
Test tjs21 Expand JSON literal with @context
6477+
</dt>
6478+
<dd>
6479+
<dl class='entry'>
6480+
<dt>id</dt>
6481+
<dd>#tjs21</dd>
6482+
<dt>Type</dt>
6483+
<dd>jld:PositiveEvaluationTest, jld:ExpandTest</dd>
6484+
<dt>Purpose</dt>
6485+
<dd>Tests expanding JSON literal with a @context.</dd>
6486+
<dt>input</dt>
6487+
<dd>
6488+
<a href='expand/js21-in.jsonld'>expand/js21-in.jsonld</a>
6489+
</dd>
6490+
<dt>expect</dt>
6491+
<dd>
6492+
<a href='expand/js21-out.jsonld'>expand/js21-out.jsonld</a>
6493+
</dd>
6494+
<dt>Options</dt>
6495+
<dd>
6496+
<dl class='options'>
6497+
<dt>specVersion</dt>
6498+
<dd>json-ld-1.1</dd>
6499+
</dl>
6500+
</dd>
6501+
</dl>
6502+
</dd>
64756503
<dt id='tl001'>
64766504
Test tl001 Language map with null value
64776505
</dt>

tests/expand-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,14 @@
19271927
"input": "expand/js20-in.jsonld",
19281928
"expect": "expand/js20-out.jsonld",
19291929
"option": {"specVersion": "json-ld-1.1"}
1930+
}, {
1931+
"@id": "#tjs21",
1932+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1933+
"name": "Expand JSON literal with @context",
1934+
"purpose": "Tests expanding JSON literal with a @context.",
1935+
"input": "expand/js21-in.jsonld",
1936+
"expect": "expand/js21-out.jsonld",
1937+
"option": {"specVersion": "json-ld-1.1"}
19301938
}, {
19311939
"@id": "#tl001",
19321940
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],

tests/expand/js21-in.jsonld

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"ex:foo": {
5+
"@type": "@json"
6+
}
7+
},
8+
"ex:foo": {
9+
"@context": "ex:not:a:context",
10+
"test": 1
11+
}
12+
}

tests/expand/js21-out.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[{
2+
"ex:foo": [{
3+
"@type": "@json",
4+
"@value": {
5+
"@context": "ex:not:a:context",
6+
"test": 1
7+
}
8+
}]
9+
}]

tests/toRdf-manifest.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6149,6 +6149,34 @@ <h2>
61496149
</dd>
61506150
</dl>
61516151
</dd>
6152+
<dt id='tjs21'>
6153+
Test tjs21 Transform JSON literal with @context
6154+
</dt>
6155+
<dd>
6156+
<dl class='entry'>
6157+
<dt>id</dt>
6158+
<dd>#tjs21</dd>
6159+
<dt>Type</dt>
6160+
<dd>jld:PositiveEvaluationTest, jld:ToRDFTest</dd>
6161+
<dt>Purpose</dt>
6162+
<dd>Tests transforming JSON literal with a @context.</dd>
6163+
<dt>input</dt>
6164+
<dd>
6165+
<a href='toRdf/js21-in.jsonld'>toRdf/js21-in.jsonld</a>
6166+
</dd>
6167+
<dt>expect</dt>
6168+
<dd>
6169+
<a href='toRdf/js21-out.nq'>toRdf/js21-out.nq</a>
6170+
</dd>
6171+
<dt>Options</dt>
6172+
<dd>
6173+
<dl class='options'>
6174+
<dt>specVersion</dt>
6175+
<dd>json-ld-1.1</dd>
6176+
</dl>
6177+
</dd>
6178+
</dl>
6179+
</dd>
61526180
<dt id='tli01'>
61536181
Test tli01 @list containing @list
61546182
</dt>

tests/toRdf-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,14 @@
18761876
"input": "toRdf/js20-in.jsonld",
18771877
"expect": "toRdf/js20-out.nq",
18781878
"option": {"specVersion": "json-ld-1.1"}
1879+
}, {
1880+
"@id": "#tjs21",
1881+
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
1882+
"name": "Transform JSON literal with @context",
1883+
"purpose": "Tests transforming JSON literal with a @context.",
1884+
"input": "toRdf/js21-in.jsonld",
1885+
"expect": "toRdf/js21-out.nq",
1886+
"option": {"specVersion": "json-ld-1.1"}
18791887
}, {
18801888
"@id": "#tli01",
18811889
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],

tests/toRdf/js21-in.jsonld

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"ex:foo": {
5+
"@type": "@json"
6+
}
7+
},
8+
"ex:foo": {
9+
"@context": "ex:not:a:context",
10+
"test": 1
11+
}
12+
}

tests/toRdf/js21-out.nq

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_:c14n0 <ex:foo> "{\"@context\":\"ex:not:a:context\",\"test\":1}"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON> .

0 commit comments

Comments
 (0)