From ec175b4af122eed833505c845ca8e466c6bf89c5 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Tue, 6 Feb 2024 23:05:37 -0500 Subject: [PATCH 1/3] Add test for `@context` redefinition. --- tests/expand-manifest.jsonld | 7 +++++++ tests/expand/er56-in.jsonld | 10 ++++++++++ tests/toRdf-manifest.jsonld | 7 +++++++ tests/toRdf/er56-in.jsonld | 10 ++++++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/expand/er56-in.jsonld create mode 100644 tests/toRdf/er56-in.jsonld diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index c18f12bb..56306e15 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1819,6 +1819,13 @@ "purpose": "The value of @type in an expanded term definition object MUST be a string or null.", "input": "expand/er55-in.jsonld", "expectErrorCode": "invalid type mapping" + }, { + "@id": "#ter56", + "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], + "name": "Invalid redefinition of @context keyword.", + "purpose": "Verifies that an exception is raise when attempting to redefine @context.", + "input": "expand/er56-in.jsonld", + "expectErrorCode": "keyword redefinition" }, { "@id": "#tes01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/er56-in.jsonld b/tests/expand/er56-in.jsonld new file mode 100644 index 00000000..157ec456 --- /dev/null +++ b/tests/expand/er56-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@context": { + "p": "ex:p" + } + }, + "@id": "ex:1", + "p": "value" +} + diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index b5448d5f..39bff97e 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -2244,6 +2244,13 @@ "purpose": "The value of @type in an expanded term definition object MUST be a string or null.", "input": "toRdf/er55-in.jsonld", "expectErrorCode": "invalid type mapping" + }, { + "@id": "#ter56", + "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], + "name": "Invalid redefinition of @context keyword.", + "purpose": "Verifies that an exception is raise when attempting to redefine @context.", + "input": "expand/er56-in.jsonld", + "expectErrorCode": "keyword redefinition" }, { "@id": "#tin01", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/er56-in.jsonld b/tests/toRdf/er56-in.jsonld new file mode 100644 index 00000000..157ec456 --- /dev/null +++ b/tests/toRdf/er56-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@context": { + "p": "ex:p" + } + }, + "@id": "ex:1", + "p": "value" +} + From 8b1cedd56df66f87a5f00126220e243db037224c Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Tue, 6 Feb 2024 23:06:18 -0500 Subject: [PATCH 2/3] Fix indentation. --- tests/toRdf-manifest.jsonld | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index 39bff97e..1fd0e98f 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -2231,19 +2231,19 @@ "expectErrorCode": "invalid @prefix value", "option": {"specVersion": "json-ld-1.1"} }, { - "@id": "#ter54", - "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], - "name": "Invalid value object, multiple values for @type.", - "purpose": "The value of @type in a value object MUST be a string or null.", - "input": "toRdf/er54-in.jsonld", - "expectErrorCode": "invalid typed value" - }, { - "@id": "#ter55", - "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], - "name": "Invalid term definition, multiple values for @type.", - "purpose": "The value of @type in an expanded term definition object MUST be a string or null.", - "input": "toRdf/er55-in.jsonld", - "expectErrorCode": "invalid type mapping" + "@id": "#ter54", + "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], + "name": "Invalid value object, multiple values for @type.", + "purpose": "The value of @type in a value object MUST be a string or null.", + "input": "toRdf/er54-in.jsonld", + "expectErrorCode": "invalid typed value" + }, { + "@id": "#ter55", + "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], + "name": "Invalid term definition, multiple values for @type.", + "purpose": "The value of @type in an expanded term definition object MUST be a string or null.", + "input": "toRdf/er55-in.jsonld", + "expectErrorCode": "invalid type mapping" }, { "@id": "#ter56", "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], From 34be31a60a9b9027d6890fc4d6d9759d451939aa Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 6 Mar 2024 11:45:39 -0800 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Dave Longley --- tests/expand-manifest.jsonld | 2 +- tests/toRdf-manifest.jsonld | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 56306e15..f09a7147 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1823,7 +1823,7 @@ "@id": "#ter56", "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], "name": "Invalid redefinition of @context keyword.", - "purpose": "Verifies that an exception is raise when attempting to redefine @context.", + "purpose": "Verifies that an exception is raised when attempting to redefine @context.", "input": "expand/er56-in.jsonld", "expectErrorCode": "keyword redefinition" }, { diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index 1fd0e98f..0fcc3354 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -2248,7 +2248,7 @@ "@id": "#ter56", "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], "name": "Invalid redefinition of @context keyword.", - "purpose": "Verifies that an exception is raise when attempting to redefine @context.", + "purpose": "Verifies that an exception is raised when attempting to redefine @context.", "input": "expand/er56-in.jsonld", "expectErrorCode": "keyword redefinition" }, {