Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON literal tests. #559

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions tests/compact-manifest.html
Original file line number Diff line number Diff line change
Expand Up @@ -4805,6 +4805,38 @@ <h2>
</dd>
</dl>
</dd>
<dt id='tej01'>
Test tej01 Multiple JSON values for a JSON literal properties
gkellogg marked this conversation as resolved.
Show resolved Hide resolved
</dt>
<dd>
<dl class='entry'>
<dt>id</dt>
<dd>#tej01</dd>
<dt>Type</dt>
<dd>jld:NegativeEvaluationTest, jld:CompactTest</dd>
<dt>Purpose</dt>
<dd>Tests compacting multiple JSON values for a JSON literal property.</dd>
<dt>input</dt>
<dd>
<a href='compact/ej01-in.jsonld'>compact/ej01-in.jsonld</a>
</dd>
<dt>context</dt>
<dd>
<a href='compact/ej01-context.jsonld'>compact/ej01-context.jsonld</a>
</dd>
<dt>expect</dt>
<dd>
multiple JSON literals
</dd>
<dt>Options</dt>
<dd>
<dl class='options'>
<dt>specVersion</dt>
<dd>json-ld-1.1</dd>
</dl>
</dd>
</dl>
</dd>
<dt id='tin01'>
Test tin01 Basic Included array
</dt>
Expand Down Expand Up @@ -5317,6 +5349,166 @@ <h2>
</dd>
</dl>
</dd>
<dt id='tjs12'>
Test tjs12 Compact JSON literal (empty array)
</dt>
<dd>
<dl class='entry'>
<dt>id</dt>
<dd>#tjs12</dd>
<dt>Type</dt>
<dd>jld:PositiveEvaluationTest, jld:CompactTest</dd>
<dt>Purpose</dt>
<dd>Tests compacting property with @type @json to a JSON literal (empty array).</dd>
<dt>input</dt>
<dd>
<a href='compact/js12-in.jsonld'>compact/js12-in.jsonld</a>
</dd>
<dt>context</dt>
<dd>
<a href='compact/js12-context.jsonld'>compact/js12-context.jsonld</a>
</dd>
<dt>expect</dt>
<dd>
<a href='compact/js12-out.jsonld'>compact/js12-out.jsonld</a>
</dd>
<dt>Options</dt>
<dd>
<dl class='options'>
<dt>specVersion</dt>
<dd>json-ld-1.1</dd>
</dl>
</dd>
</dl>
</dd>
<dt id='tjs13'>
Test tjs13 Compact JSON literal (array with string)
</dt>
<dd>
<dl class='entry'>
<dt>id</dt>
<dd>#tjs13</dd>
<dt>Type</dt>
<dd>jld:PositiveEvaluationTest, jld:CompactTest</dd>
<dt>Purpose</dt>
<dd>Tests compacting property with @type @json to a JSON literal (array with string).</dd>
<dt>input</dt>
<dd>
<a href='compact/js13-in.jsonld'>compact/js13-in.jsonld</a>
</dd>
<dt>context</dt>
<dd>
<a href='compact/js13-context.jsonld'>compact/js13-context.jsonld</a>
</dd>
<dt>expect</dt>
<dd>
<a href='compact/js13-out.jsonld'>compact/js13-out.jsonld</a>
</dd>
<dt>Options</dt>
<dd>
<dl class='options'>
<dt>specVersion</dt>
<dd>json-ld-1.1</dd>
</dl>
</dd>
</dl>
</dd>
<dt id='tjs14'>
Test tjs14 Compact JSON literal and non-JSON with @json property
</dt>
<dd>
<dl class='entry'>
<dt>id</dt>
<dd>#tjs14</dd>
<dt>Type</dt>
<dd>jld:PositiveEvaluationTest, jld:CompactTest</dd>
<dt>Purpose</dt>
<dd>Tests compacting property with @type @json with JSON literal and non-JSON.</dd>
<dt>input</dt>
<dd>
<a href='compact/js14-in.jsonld'>compact/js14-in.jsonld</a>
</dd>
<dt>context</dt>
<dd>
<a href='compact/js14-context.jsonld'>compact/js14-context.jsonld</a>
</dd>
<dt>expect</dt>
<dd>
<a href='compact/js14-out.jsonld'>compact/js14-out.jsonld</a>
</dd>
<dt>Options</dt>
<dd>
<dl class='options'>
<dt>specVersion</dt>
<dd>json-ld-1.1</dd>
</dl>
</dd>
</dl>
</dd>
<dt id='tjs15'>
Test tjs15 Compact JSON literal and non-JSON without @json property
</dt>
<dd>
<dl class='entry'>
<dt>id</dt>
<dd>#tjs15</dd>
<dt>Type</dt>
<dd>jld:PositiveEvaluationTest, jld:CompactTest</dd>
<dt>Purpose</dt>
<dd>Tests compacting property without @type @json with JSON literal and non-JSON.</dd>
<dt>input</dt>
<dd>
<a href='compact/js15-in.jsonld'>compact/js15-in.jsonld</a>
</dd>
<dt>context</dt>
<dd>
<a href='compact/js15-context.jsonld'>compact/js15-context.jsonld</a>
</dd>
<dt>expect</dt>
<dd>
<a href='compact/js15-out.jsonld'>compact/js15-out.jsonld</a>
</dd>
<dt>Options</dt>
<dd>
<dl class='options'>
<dt>specVersion</dt>
<dd>json-ld-1.1</dd>
</dl>
</dd>
</dl>
</dd>
<dt id='tjs16'>
Test tjs16 Compact JSON literal and non-JSON with and without @json property
</dt>
<dd>
<dl class='entry'>
<dt>id</dt>
<dd>#tjs16</dd>
<dt>Type</dt>
<dd>jld:PositiveEvaluationTest, jld:CompactTest</dd>
<dt>Purpose</dt>
<dd>Tests compacting property with and without @type @json with JSON literal and non-JSON.</dd>
<dt>input</dt>
<dd>
<a href='compact/js16-in.jsonld'>compact/js16-in.jsonld</a>
</dd>
<dt>context</dt>
<dd>
<a href='compact/js16-context.jsonld'>compact/js16-context.jsonld</a>
</dd>
<dt>expect</dt>
<dd>
<a href='compact/js16-out.jsonld'>compact/js16-out.jsonld</a>
</dd>
<dt>Options</dt>
<dd>
<dl class='options'>
<dt>specVersion</dt>
<dd>json-ld-1.1</dd>
</dl>
</dd>
</dl>
</dd>
<dt id='tla01'>
Test tla01 most specific term matching in @list.
</dt>
Expand Down
54 changes: 54 additions & 0 deletions tests/compact-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,15 @@
"input": "compact/ep15-in.jsonld",
"context": "compact/ep15-context.jsonld",
"expectErrorCode": "invalid container mapping"
}, {
"@id": "#tej01",
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
"name": "Multiple JSON values for a JSON literal properties",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goes with change elsewhere

Suggested change
"name": "Multiple JSON values for a JSON literal properties",
"name": "Multiple JSON values for a JSON literal property",

"purpose": "Tests compacting multiple JSON values for a JSON literal property.",
"input": "compact/ej01-in.jsonld",
"context": "compact/ej01-context.jsonld",
"expectErrorCode": "multiple JSON literals",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tin01",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Expand Down Expand Up @@ -1549,6 +1558,51 @@
"context": "compact/js11-context.jsonld",
"expect": "compact/js11-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tjs12",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact JSON literal (empty array)",
"purpose": "Tests compacting property with @type @json to a JSON literal (empty array).",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"purpose": "Tests compacting property with @type @json to a JSON literal (empty array).",
"purpose": "Tests compacting property with @type @json to a JSON literal (array with string).",

"input": "compact/js12-in.jsonld",
"context": "compact/js12-context.jsonld",
"expect": "compact/js12-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tjs13",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact JSON literal (array with string)",
"purpose": "Tests compacting property with @type @json to a JSON literal (array with string).",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"purpose": "Tests compacting property with @type @json to a JSON literal (array with string).",
"purpose": "Tests compacting property with @type @json to a JSON literal (empty array).",

"input": "compact/js13-in.jsonld",
"context": "compact/js13-context.jsonld",
"expect": "compact/js13-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tjs14",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact JSON literal and non-JSON with @json property",
"purpose": "Tests compacting property with @type @json with JSON literal and non-JSON.",
"input": "compact/js14-in.jsonld",
"context": "compact/js14-context.jsonld",
"expect": "compact/js14-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tjs15",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact JSON literal and non-JSON without @json property",
"purpose": "Tests compacting property without @type @json with JSON literal and non-JSON.",
"input": "compact/js15-in.jsonld",
"context": "compact/js15-context.jsonld",
"expect": "compact/js15-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tjs16",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compact JSON literal and non-JSON with and without @json property",
"purpose": "Tests compacting property with and without @type @json with JSON literal and non-JSON.",
"input": "compact/js16-in.jsonld",
"context": "compact/js16-context.jsonld",
"expect": "compact/js16-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tla01",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Expand Down
6 changes: 6 additions & 0 deletions tests/compact/ej01-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
}
}
9 changes: 9 additions & 0 deletions tests/compact/ej01-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[{
"http://example.org/vocab#value": [{
"@value": ["JSON1"],
"@type": "@json"
}, {
"@value": ["JSON2"],
"@type": "@json"
}]
}]
4 changes: 2 additions & 2 deletions tests/compact/js07-out.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#array", "@type": "@json", "@container": "@set"}
},
"e": [{"foo": "bar"}]
}
"e": [[{"foo": "bar"}]]
}
6 changes: 6 additions & 0 deletions tests/compact/js12-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
}
}
6 changes: 6 additions & 0 deletions tests/compact/js12-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[{
"http://example.org/vocab#value": [{
"@value": ["string"],
"@type": "@json"
}]
}]
7 changes: 7 additions & 0 deletions tests/compact/js12-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
},
"e": ["string"]
}
6 changes: 6 additions & 0 deletions tests/compact/js13-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
}
}
6 changes: 6 additions & 0 deletions tests/compact/js13-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[{
"http://example.org/vocab#value": [{
"@value": [],
"@type": "@json"
}]
}]
7 changes: 7 additions & 0 deletions tests/compact/js13-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
},
"e": []
}
6 changes: 6 additions & 0 deletions tests/compact/js14-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
}
}
8 changes: 8 additions & 0 deletions tests/compact/js14-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"http://example.org/vocab#value": [{
"@value": [],
"@type": "@json"
},
"non-JSON"
]
}]
8 changes: 8 additions & 0 deletions tests/compact/js14-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value", "@type": "@json"}
},
"e": [],
"http://example.org/vocab#value": "non-JSON"
}
6 changes: 6 additions & 0 deletions tests/compact/js15-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value"}
}
}
8 changes: 8 additions & 0 deletions tests/compact/js15-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"http://example.org/vocab#value": [{
"@value": [],
"@type": "@json"
},
"non-JSON"
]
}]
13 changes: 13 additions & 0 deletions tests/compact/js15-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"@context": {
"@version": 1.1,
"e": {"@id": "http://example.org/vocab#value"}
},
"e": [
{
"@type": "@json",
"@value": []
},
"non-JSON"
]
}
Loading