Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswr committed Jul 20, 2022
1 parent ee09176 commit 31a3bb9
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/IManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function manifestFromResource(testCaseHandlers: {[uri: string]: ITe
manifestFromSpecificationResource(testCaseHandlers, options, specificationResource) }))))) : null,
subManifests: await Promise.all<IManifest>([].concat.apply([],
resource.properties.include.map((includeList: Resource) => includeList.list
.map(manifestFromResource.bind(null, testCaseHandlers, options))))),
.map(resource => manifestFromResource(testCaseHandlers, options, resource))))),
testEntries: (await Promise.all<ITestCase<any>>([].concat.apply([],
resource.properties.entries.map(
(entryList: Resource) => (entryList.list || [entryList])
Expand Down
9 changes: 8 additions & 1 deletion lib/ManifestLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ export class ManifestLoader {
includeJobs.push(this.import(objectLoader, include.value, options));
}
}
await Promise.all(includeJobs);
const jobs: Resource[] = await Promise.all(includeJobs);

console.log('------------------------------------------------------------');
console.log('include jobs')
console.log(jobs)
console.log('------------------------------------------------------------');
// console.log(jobs.map(job => this.from(job.term.value)))


return manifest;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/TestSuiteRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class TestSuiteRunner {
config: ITestSuiteConfig,
results: ITestResult[],
) {
console.log('top level running manifest', manifest)
// Execute all tests in this manifest
if (manifest.testEntries) {
for (const test of manifest.testEntries) {
Expand Down Expand Up @@ -125,6 +126,7 @@ export class TestSuiteRunner {
// Recursively handle all sub-manifests
if (manifest.subManifests) {
for (const subManifest of manifest.subManifests) {
// console.log('running subManifest', subManifest)
await (this.runManifestConcrete(subManifest, handler, config, results));
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Util {
|| contentType.indexOf('text/turtle') >= 0
|| contentType.indexOf('application/n-triples') >= 0
|| contentType.indexOf('application/n-quads') >= 0) {
return data.pipe(new GeneralizedN3StreamParser({ baseIRI, format: contentType }));
return data.pipe(new GeneralizedN3StreamParser({ baseIRI, format: contentType, }));
}
if (contentType.indexOf('application/rdf+xml') >= 0) {
return data.pipe(new RdfXmlParser({ baseIRI }));
Expand Down
69 changes: 69 additions & 0 deletions test/ManifestLoader-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ const streamifyString = require('streamify-string');
<http://valid1> a mf:Manifest ;
rdfs:label "SPARQL 1.1 tests".
`);
break;
case 'http://valid1/with/slash/manifest.jsonld':
body = streamifyString(`
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
<http://valid1/with/slash#manifest> a mf:Manifest ;
rdfs:label "SPARQL 1.1 tests".
`);
break;
case 'http://validsub1':
Expand Down Expand Up @@ -65,6 +76,42 @@ const streamifyString = require('streamify-string');
mf:include ("http://invalid1").
`);
break;
case 'https://w3c.github.io/rdf-star/tests/manifest.jsonld':
body = streamifyString(`
## [1] https://www.w3.org/Consortium/Legal/2008/04-testsuite-license
## [2] https://www.w3.org/Consortium/Legal/2008/03-bsd-license
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#>
PREFIX rdft: <http://www.w3.org/ns/rdftest#>
PREFIX trs: <https://w3c.github.io/rdf-star/tests#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
trs:manifest rdf:type mf:Manifest ;
rdfs:label "RDF-star test suite"@en ;
skos:prefLabel "La suite des tests pour RDF-star"@fr;
skos:prefLabel "Conjunto de pruebas para RDF-star"@es;
dct:issued "2021-06-21"^^xsd:date ;
rdfs:seeAlso <https://w3c.github.io/rdf-tests/> ;
dct:modified "2021-07-18"^^xsd:date ;
dct:licence <https://www.w3.org/Consortium/Legal/2008/03-bsd-license> ;
dct:creator [ foaf:homepage <https://w3c.github.io/rdf-star/> ; foaf:name " RDF-star Interest Group within the W3C RDF-DEV Community Group" ] ;
mf:include (
<nt/syntax/manifest.ttl>
<semantics/manifest.ttl>
<sparql/eval/manifest.ttl>
<sparql/syntax/manifest.ttl>
<trig/eval/manifest.ttl>
<trig/syntax/manifest.ttl>
<turtle/eval/manifest.ttl>
<turtle/syntax/manifest.ttl>
) .
`);
break;
default:
body = streamifyString('ABC');
break;
Expand Down Expand Up @@ -139,6 +186,28 @@ describe('ManifestLoader', () => {
});
});

it('should apply / => # conversion required by RDF-star test suite', () => {
return expect(loader.from('http://valid1/with/slash/manifest.jsonld')).resolves.toEqual({
comment: null,
label: 'SPARQL 1.1 tests',
specifications: null,
subManifests: [],
testEntries: [],
uri: 'http://valid1/with/slash#manifest',
});
});

it('should load sub-manifests for the RDF-star test suite', () => {
return expect(loader.from('https://w3c.github.io/rdf-star/tests/manifest.jsonld')).resolves.toEqual({
comment: null,
label: 'SPARQL 1.1 tests',
specifications: null,
subManifests: [],
testEntries: [],
uri: 'https://w3c.github.io/rdf-star/tests#manifest',
});
});

it('should error on invalid submanifests', () => {
return expect(loader.from('http://invalidsub1')).rejects.toBeTruthy();
});
Expand Down

0 comments on commit 31a3bb9

Please sign in to comment.