Skip to content

Commit

Permalink
Test protected flag retained during redefinition.
Browse files Browse the repository at this point in the history
- Add expand and toRdf tests to check protection flag is retained when a
  term is redefined the same as a protected term, and then redefined as
  something else, triggering a failure.
- See 4.1.11 https://www.w3.org/TR/json-ld11/#protected-term-definitions
  about similar overrides that don't change semantics of the protected
  term.
- See 4.2.2.27.2 https://www.w3.org/TR/json-ld-api/#algorithm-0 about
  retaining the value of protected flag.
  • Loading branch information
davidlehn committed Feb 21, 2024
1 parent 229c823 commit 84159ed
Show file tree
Hide file tree
Showing 4 changed files with 46 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 @@ -2843,6 +2843,14 @@
"option": {"specVersion": "json-ld-1.1"},
"input": "expand/pr41-in.jsonld",
"expect": "expand/pr41-out.jsonld"
}, {
"@id": "#tpr42",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
"name": "Fail if protected flag not retained during redefinition",
"purpose": "Check protected redefinition retains protected flag.",
"option": {"specVersion": "json-ld-1.1"},
"input": "expand/pr42-in.jsonld",
"expectErrorCode": "protected term redefinition"
}, {
"@id": "#tso01",
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
Expand Down
15 changes: 15 additions & 0 deletions tests/expand/pr42-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": [
{
"@protected": true,
"protected": "ex:protected"
},
{
"protected": "ex:protected"
},
{
"protected": "ex:unprotected"
}
],
"protected": "fail / protection not retained during redefinition"
}
8 changes: 8 additions & 0 deletions tests/toRdf-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -3372,6 +3372,14 @@
"option": {"specVersion": "json-ld-1.1"},
"input": "toRdf/pr41-in.jsonld",
"expect": "toRdf/pr41-out.nq"
}, {
"@id": "#tpr42",
"@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest"],
"name": "Fail if protected flag not retained during redefinition",
"purpose": "Check protected redefinition retains protected flag.",
"option": {"specVersion": "json-ld-1.1"},
"input": "toRdf/pr42-in.jsonld",
"expectErrorCode": "protected term redefinition"
}, {
"@id": "#trt01",
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
Expand Down
15 changes: 15 additions & 0 deletions tests/toRdf/pr42-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": [
{
"@protected": true,
"protected": "ex:protected"
},
{
"protected": "ex:protected"
},
{
"protected": "ex:unprotected"
}
],
"protected": "fail / protection not retained during redefinition"
}

0 comments on commit 84159ed

Please sign in to comment.