Skip to content

Commit

Permalink
Add graph container null context protection test.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlehn committed Mar 8, 2024
1 parent a41bae0 commit 385d101
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/expand-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -2858,6 +2858,14 @@
"option": {"specVersion": "json-ld-1.1"},
"input": "expand/pr42-in.jsonld",
"expectErrorCode": "protected term redefinition"
}, {
"@id": "#tpr43",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Clear protection in @graph @container with null context.",
"purpose": "Clear protection in @graph @container with null context.",
"option": {"specVersion": "json-ld-1.1"},
"input": "expand/pr43-in.jsonld",
"expect": "expand/pr43-out.jsonld"
}, {
"@id": "#tso01",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
Expand Down
23 changes: 23 additions & 0 deletions tests/expand/pr43-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"@context": {
"@protected": true,
"protected": {
"@id": "ex:protected1",
"@type": "@id"
},
"unprotected": {
"@id": "ex:unprotected",
"@type": "@id",
"@container": "@graph",
"@context": null
}
},
"@id": "ex:outer",
"unprotected": {
"@context": {
"protected": "ex:protected2"
},
"@id": "ex:inner",
"protected": "p === ex:protected2"
}
}
19 changes: 19 additions & 0 deletions tests/expand/pr43-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"@id": "ex:outer",
"ex:unprotected": [
{
"@graph": [
{
"@id": "ex:inner",
"ex:protected2": [
{
"@value": "p === ex:protected2"
}
]
}
]
}
]
}
]
8 changes: 8 additions & 0 deletions tests/toRdf-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -3387,6 +3387,14 @@
"option": {"specVersion": "json-ld-1.1"},
"input": "toRdf/pr42-in.jsonld",
"expectErrorCode": "protected term redefinition"
}, {
"@id": "#tpr43",
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
"name": "Clear protection in @graph @container with null context.",
"purpose": "Clear protection in @graph @container with null context.",
"option": {"specVersion": "json-ld-1.1"},
"input": "toRdf/pr43-in.jsonld",
"expect": "toRdf/pr43-out.nq"
}, {
"@id": "#trt01",
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
Expand Down
23 changes: 23 additions & 0 deletions tests/toRdf/pr43-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"@context": {
"@protected": true,
"protected": {
"@id": "ex:protected1",
"@type": "@id"
},
"unprotected": {
"@id": "ex:unprotected",
"@type": "@id",
"@container": "@graph",
"@context": null
}
},
"@id": "ex:outer",
"unprotected": {
"@context": {
"protected": "ex:protected2"
},
"@id": "ex:inner",
"protected": "p === ex:protected2"
}
}
2 changes: 2 additions & 0 deletions tests/toRdf/pr43-out.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<ex:outer> <ex:unprotected> _:b0 .
<ex:inner> <ex:protected2> "p === ex:protected2" _:b0 .

0 comments on commit 385d101

Please sign in to comment.