Skip to content

Commit e362d0e

Browse files
committed
Add support for new JSON-LD test suite
1 parent 76e55c0 commit e362d0e

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Currently, the following test suites are supported:
1919
* [N-Quads](https://w3c.github.io/rdf-tests/nquads/)
2020
* [Turtle](https://w3c.github.io/rdf-tests/turtle/)
2121
* [TriG](https://w3c.github.io/rdf-tests/trig/)
22-
* [JSON-LD](https://json-ld.org/test-suite/)
22+
* [JSON-LD](https://w3c.github.io/json-ld-api/tests/)
2323

2424
Not all [RDF test suites](https://w3c.github.io/rdf-tests/) are supported at the moment.
2525
However, this package is fully _modular_,
@@ -28,7 +28,7 @@ so that support for different test cases can be implemented easily.
2828
Planned support:
2929
* [SPARQL 1.1](http://w3c.github.io/rdf-tests/sparql11/data-sparql11/) (_other specifications_)
3030
* [RDF Schema and Semantics](https://w3c.github.io/rdf-tests/rdf-mt/reports/)
31-
* [JSON-LD](https://json-ld.org/test-suite/) (_other test suites_)
31+
* [JSON-LD](https://w3c.github.io/json-ld-api/tests/) (_other test suites_)
3232

3333
## Installation
3434

@@ -236,7 +236,8 @@ $ rdf-test-suite myengine.js http://w3c.github.io/rdf-tests/sparql11/data-sparql
236236
| [N-Quads Tests](https://w3c.github.io/rdf-tests/nquads/) | [RDF 1.1 N-Quads](https://www.w3.org/TR/n-quads/) | [`IParser`](https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/rdfsyntax/IParser.ts) | http://w3c.github.io/rdf-tests/nquads/manifest.ttl |
237237
| [Turtle Tests](https://w3c.github.io/rdf-tests/turtle/) | [RDF 1.1 Turtle](https://www.w3.org/TR/turtle/) | [`IParser`](https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/rdfsyntax/IParser.ts) | http://w3c.github.io/rdf-tests/turtle/manifest.ttl |
238238
| [TriG Tests](https://w3c.github.io/rdf-tests/trig/) | [RDF 1.1 TriG](https://www.w3.org/TR/trig/) | [`IParser`](https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/rdfsyntax/IParser.ts) | http://w3c.github.io/rdf-tests/trig/manifest.ttl |
239-
| [JSON-LD Test Suite](https://json-ld.org/test-suite/) | [JSON-LD 1.0](https://www.w3.org/TR/json-ld/) | [`IParser`](https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/rdfsyntax/IParser.ts) | https://json-ld.org/test-suite/tests/toRdf-manifest.jsonld, https://json-ld.org/test-suite/tests/error-manifest.jsonld |
239+
| [JSON-LD Test Suite](https://w3c.github.io/json-ld-api/tests/) | [JSON-LD 1.0](https://www.w3.org/TR/json-ld/) | [`IParser`](https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/rdfsyntax/IParser.ts) | https://w3c.github.io/json-ld-api/tests/toRdf-manifest.jsonld |
240+
| [JSON-LD Test Suite (old)](https://json-ld.org/test-suite/) | [JSON-LD 1.0](https://www.w3.org/TR/json-ld/) | [`IParser`](https://github.com/rubensworks/rdf-test-suite.js/blob/master/lib/testcase/rdfsyntax/IParser.ts) | https://json-ld.org/test-suite/tests/toRdf-manifest.jsonld, https://json-ld.org/test-suite/tests/error-manifest.jsonld |
240241

241242
## License
242243
This software is written by [Ruben Taelman](http://rubensworks.net/).

lib/testcase/TestCaseHandlers.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {TestCaseJsonLdNegativeSyntaxHandler} from "./rdfsyntax/jsonld/TestCaseJsonLdNegativeSyntax";
1+
import {TestCaseJsonLdSyntaxHandler} from "./rdfsyntax/jsonld/TestCaseJsonLdSyntax";
22
import {TestCaseJsonLdToRdfHandler} from "./rdfsyntax/jsonld/TestCaseJsonLdToRdf";
33
import {TestCaseEvalHandler} from "./rdfsyntax/TestCaseEval";
44
import {TestCaseSyntaxHandler} from "./rdfsyntax/TestCaseSyntax";
@@ -79,6 +79,10 @@ module.exports = {
7979
'https://json-ld.org/test-suite/vocab#ToRDFTest':
8080
new TestCaseJsonLdToRdfHandler(),
8181
'https://json-ld.org/test-suite/vocab#NegativeEvaluationTest':
82-
new TestCaseJsonLdNegativeSyntaxHandler(),
82+
new TestCaseJsonLdSyntaxHandler(false),
83+
'https://w3c.github.io/json-ld-api/tests/vocab#PositiveEvaluationTest':
84+
new TestCaseJsonLdToRdfHandler(),
85+
'https://w3c.github.io/json-ld-api/tests/vocab#PositiveSyntaxTest':
86+
new TestCaseJsonLdSyntaxHandler(true),
8387
};
8488
// tslint:enable:object-literal-sort-keys

lib/testcase/rdfsyntax/jsonld/TestCaseJsonLdNegativeSyntax.ts renamed to lib/testcase/rdfsyntax/jsonld/TestCaseJsonLdSyntax.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import {TestCaseSyntax, TestCaseSyntaxHandler} from "../TestCaseSyntax";
44
import {TestCaseJsonLdToRdfHandler} from "./TestCaseJsonLdToRdf";
55

66
/**
7-
* Test case handler for https://json-ld.org/test-suite/vocab#NegativeEvaluationTest.
7+
* Test case handler for:
8+
* * https://json-ld.org/test-suite/vocab#NegativeEvaluationTest
9+
* * https://w3c.github.io/json-ld-api/tests/vocab#PositiveSyntaxTest
810
*/
9-
export class TestCaseJsonLdNegativeSyntaxHandler extends TestCaseSyntaxHandler {
11+
export class TestCaseJsonLdSyntaxHandler extends TestCaseSyntaxHandler {
1012

11-
constructor() {
12-
super(false);
13+
constructor(expectNoError: boolean) {
14+
super(expectNoError);
1315
}
1416

1517
public resourceToTestCase(resource: Resource, testCaseData: ITestCaseData,

lib/testcase/rdfsyntax/jsonld/TestCaseJsonLdToRdf.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import {IParser} from "../IParser";
55
import {TestCaseEval, TestCaseEvalHandler} from "../TestCaseEval";
66

77
/**
8-
* Test case handler for https://json-ld.org/test-suite/vocab#ToRDFTest.
8+
* Test case handler for:
9+
* * https://json-ld.org/test-suite/vocab#ToRDFTest
10+
* * https://w3c.github.io/json-ld-api/tests/vocab#PositiveEvaluationTest
911
*/
1012
export class TestCaseJsonLdToRdfHandler extends TestCaseEvalHandler {
1113

test/testcase/rdfsyntax/jsonld/TestCaseJsonLdNegativeSyntaxHandler-test.ts renamed to test/testcase/rdfsyntax/jsonld/TestCaseJsonLdSyntaxHandler-test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {JsonLdParser} from "jsonld-streaming-parser";
55
import {Resource} from "rdf-object";
66
import {ErrorSkipped} from "../../../../lib/ErrorSkipped";
77
import {
8-
TestCaseJsonLdNegativeSyntaxHandler,
9-
} from "../../../../lib/testcase/rdfsyntax/jsonld/TestCaseJsonLdNegativeSyntax";
8+
TestCaseJsonLdSyntaxHandler,
9+
} from "../../../../lib/testcase/rdfsyntax/jsonld/TestCaseJsonLdSyntax";
1010
import {TestCaseSyntax} from "../../../../lib/testcase/rdfsyntax/TestCaseSyntax";
1111

1212
// tslint:disable:no-var-requires
@@ -36,9 +36,9 @@ const streamifyString = require('streamify-string');
3636
return Promise.resolve(new Response(body, <any> { headers: new Headers({ a: 'b' }), status: 200, url }));
3737
};
3838

39-
describe('TestCaseJsonLdNegativeSyntaxHandler', () => {
39+
describe('TestCaseJsonLdSyntaxHandler', () => {
4040

41-
const handler = new TestCaseJsonLdNegativeSyntaxHandler();
41+
const handler = new TestCaseJsonLdSyntaxHandler(false);
4242
const parser = {
4343
parse: (data: string, baseIRI: string) => Promise.resolve(arrayifyStream(streamifyString(data)
4444
.pipe(new JsonLdParser({ baseIRI })))),

0 commit comments

Comments
 (0)