Skip to content

Commit f6f22e4

Browse files
committed
Add context recursion tests.
- 1.0 expand: - e003 looked like e002. Made it use a level of indirection. - 1.1 expand: - Copy e002 and e003 to e052 and e053 and use newer "context overflow" code. - Add e054 cross linked sibling contexts test. - Add 0124, 0125, 0126 scoped context recursion tests.
1 parent 2c8e6ed commit f6f22e4

21 files changed

+187
-1
lines changed

tests/expand-manifest.jsonld

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,30 @@
924924
"input": "expand/0123-in.jsonld",
925925
"expectErrorCode": "invalid typed value",
926926
"option": {"specVersion": "json-ld-1.1"}
927+
}, {
928+
"@id": "#t0124",
929+
"@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ],
930+
"name": "A scoped context may include itself recursively (direct)",
931+
"purpose": "Verifies that no exception is raised on expansion when processing a scoped context referencing itself directly",
932+
"input": "expand/0124-in.jsonld",
933+
"expect": "expand/0124-out.jsonld",
934+
"option": {"specVersion": "json-ld-1.1"}
935+
}, {
936+
"@id": "#t0125",
937+
"@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ],
938+
"name": "A scoped context may include itself recursively (indirect)",
939+
"purpose": "Verifies that no exception is raised on expansion when processing a scoped context referencing itself indirectly",
940+
"input": "expand/0125-in.jsonld",
941+
"expect": "expand/0125-out.jsonld",
942+
"option": {"specVersion": "json-ld-1.1"}
943+
}, {
944+
"@id": "#t0126",
945+
"@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ],
946+
"name": "Two scoped context may include a shared context",
947+
"purpose": "Verifies that no exception is raised on expansion when processing two scoped contexts referencing a shared context",
948+
"input": "expand/0126-in.jsonld",
949+
"expect": "expand/0126-out.jsonld",
950+
"option": {"specVersion": "json-ld-1.1"}
927951
}, {
928952
"@id": "#tc001",
929953
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
@@ -1624,6 +1648,30 @@
16241648
"purpose": "Verifies that an exception is raised in Expansion when an invalid value object value is found using a value alias",
16251649
"input": "expand/e051-in.jsonld",
16261650
"expectErrorCode": "invalid value object value"
1651+
}, {
1652+
"@id": "#te052",
1653+
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],
1654+
"name": "A context may not include itself recursively (direct)",
1655+
"purpose": "Verifies that an exception is raised on expansion when processing a context referencing itself",
1656+
"input": "expand/e052-in.jsonld",
1657+
"expectErrorCode": "context overflow",
1658+
"option": {"specVersion": "json-ld-1.1"}
1659+
}, {
1660+
"@id": "#te053",
1661+
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],
1662+
"name": "A context may not include itself recursively (indirect)",
1663+
"purpose": "Verifies that an exception is raised on expansion when processing a context referencing itself indirectly",
1664+
"input": "expand/e053-in.jsonld",
1665+
"expectErrorCode": "context overflow",
1666+
"option": {"specVersion": "json-ld-1.1"}
1667+
}, {
1668+
"@id": "#te054",
1669+
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],
1670+
"name": "A context may not include itself recursively (siblings)",
1671+
"purpose": "Verifies that an exception is raised on expansion when processing a context referencing itself through a sibling",
1672+
"input": "expand/e054-in.jsonld",
1673+
"expectErrorCode": "context overflow",
1674+
"option": {"specVersion": "json-ld-1.1"}
16271675
}, {
16281676
"@id": "#tec01",
16291677
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],

tests/expand/0124-context.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+
"prop": {
5+
"@id": "ex:prop",
6+
"@context": "0124-context.jsonld"
7+
},
8+
"value": {
9+
"@id": "ex:value"
10+
}
11+
}
12+
}

tests/expand/0124-in.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": "0124-context.jsonld",
3+
"@id": "ex:id",
4+
"prop": {
5+
"value": "v"
6+
}
7+
}

tests/expand/0124-out.jsonld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"@id": "ex:id",
4+
"ex:prop": [
5+
{
6+
"ex:value": [
7+
{
8+
"@value": "v"
9+
}
10+
]
11+
}
12+
]
13+
}
14+
]

tests/expand/0125-context-1.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+
"prop": {
5+
"@id": "ex:prop",
6+
"@context": "0125-context-2.jsonld"
7+
},
8+
"value": {
9+
"@id": "ex:value"
10+
}
11+
}
12+
}

tests/expand/0125-context-2.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "0125-context-1.jsonld"
3+
}

tests/expand/0125-in.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": "0125-context-1.jsonld",
3+
"@id": "ex:id",
4+
"prop": {
5+
"value": "v"
6+
}
7+
}

tests/expand/0125-out.jsonld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"@id": "ex:id",
4+
"ex:prop": [
5+
{
6+
"ex:value": [
7+
{
8+
"@value": "v"
9+
}
10+
]
11+
}
12+
]
13+
}
14+
]

tests/expand/0126-context-1.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "0126-context-3.jsonld"
3+
}

tests/expand/0126-context-2.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "0126-context-3.jsonld"
3+
}

tests/expand/0126-context-3.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+
"prop": {
5+
"@id": "ex:prop",
6+
"@context": "0126-context-3.jsonld"
7+
},
8+
"value": {
9+
"@id": "ex:value"
10+
}
11+
}
12+
}

tests/expand/0126-in.jsonld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"@context": [
3+
"0126-context-1.jsonld",
4+
"0126-context-2.jsonld"
5+
],
6+
"@id": "ex:id",
7+
"prop": {
8+
"value": "v"
9+
}
10+
}

tests/expand/0126-out.jsonld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"@id": "ex:id",
4+
"ex:prop": [
5+
{
6+
"ex:value": [
7+
{
8+
"@value": "v"
9+
}
10+
]
11+
}
12+
]
13+
}
14+
]

tests/expand/e003-context.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "e003-in.jsonld"
3+
}

tests/expand/e003-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"@context": "e003-in.jsonld",
2+
"@context": "e003-context.jsonld",
33
"@id": "http://example/test#example"
44
}

tests/expand/e052-in.jsonld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"@context": "e052-in.jsonld",
3+
"@id": "http://example/test#example"
4+
}

tests/expand/e053-context.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "e053-in.jsonld"
3+
}

tests/expand/e053-in.jsonld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"@context": "e053-context.jsonld",
3+
"@id": "http://example/test#example"
4+
}

tests/expand/e054-context-1.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "e054-context-2.jsonld"
3+
}

tests/expand/e054-context-2.jsonld

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@context": "e054-context-1.jsonld"
3+
}

tests/expand/e054-in.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": [
3+
"e054-context-1.jsonld",
4+
"e054-context-2.jsonld"
5+
],
6+
"@id": "ex:id"
7+
}

0 commit comments

Comments
 (0)