Skip to content

Commit 406dec7

Browse files
davidlehngkellogg
authored andcommitted
Test protected flag retained during redefinition.
- 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.
1 parent 26f08b8 commit 406dec7

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

tests/expand-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,6 +2843,14 @@
28432843
"option": {"specVersion": "json-ld-1.1"},
28442844
"input": "expand/pr41-in.jsonld",
28452845
"expect": "expand/pr41-out.jsonld"
2846+
}, {
2847+
"@id": "#tpr42",
2848+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
2849+
"name": "Fail if protected flag not retained during redefinition",
2850+
"purpose": "Check protected redefinition retains protected flag.",
2851+
"option": {"specVersion": "json-ld-1.1"},
2852+
"input": "expand/pr42-in.jsonld",
2853+
"expectErrorCode": "protected term redefinition"
28462854
}, {
28472855
"@id": "#tso01",
28482856
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],

tests/expand/pr42-in.jsonld

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"@context": [
3+
{
4+
"@protected": true,
5+
"protected": "ex:protected"
6+
},
7+
{
8+
"protected": "ex:protected"
9+
},
10+
{
11+
"protected": "ex:unprotected"
12+
}
13+
],
14+
"protected": "fail / should retain protection during redefinition"
15+
}

tests/toRdf-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3372,6 +3372,14 @@
33723372
"option": {"specVersion": "json-ld-1.1"},
33733373
"input": "toRdf/pr41-in.jsonld",
33743374
"expect": "toRdf/pr41-out.nq"
3375+
}, {
3376+
"@id": "#tpr42",
3377+
"@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest"],
3378+
"name": "Fail if protected flag not retained during redefinition",
3379+
"purpose": "Check protected redefinition retains protected flag.",
3380+
"option": {"specVersion": "json-ld-1.1"},
3381+
"input": "toRdf/pr42-in.jsonld",
3382+
"expectErrorCode": "protected term redefinition"
33753383
}, {
33763384
"@id": "#trt01",
33773385
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],

tests/toRdf/pr42-in.jsonld

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"@context": [
3+
{
4+
"@protected": true,
5+
"protected": "ex:protected"
6+
},
7+
{
8+
"protected": "ex:protected"
9+
},
10+
{
11+
"protected": "ex:unprotected"
12+
}
13+
],
14+
"protected": "fail / should retain protection during redefinition"
15+
}

0 commit comments

Comments
 (0)