Skip to content

Commit

Permalink
Always include input when logging test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 5, 2018
1 parent fa18815 commit 726438b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/testcase/rdfsyntax/TestCaseEval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class TestCaseEval implements ITestCaseRdfSyntax {
const quads: RDF.Quad[] = await parser.parse(this.data, this.baseIRI, injectArguments);
if (!isomorphic(quads, this.expected)) {
throw new Error(`Invalid data parsing
Query: ${this.data}
Input: ${this.data}
Expected: ${JSON.stringify(this.expected.map(quadToStringQuad), null, ' ')}
Expand Down
4 changes: 2 additions & 2 deletions lib/testcase/rdfsyntax/TestCaseSyntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ export class TestCaseSyntax implements ITestCaseRdfSyntax {
} catch (e) {
if (this.expectNoError) {
throw new Error(`Expected not throw an error when parsing.
Query: ${this.data}
Input: ${this.data}
Error: ${e}
`);
}
return;
}
if (!this.expectNoError) {
throw new Error(`Expected to throw an error when parsing.
Query: ${this.data}
Input: ${this.data}
`);
}
}
Expand Down
4 changes: 3 additions & 1 deletion lib/testcase/sparql/TestCaseNegativeSyntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export class TestCaseNegativeSyntax implements ITestCaseSparql {
} catch (e) {
return;
}
throw new Error(`Expected ${this.queryString} to throw an error when parsing.`);
throw new Error(`Expected ${this.queryString} to throw an error when parsing.
Input: ${this.queryString}
`);
}

}
9 changes: 8 additions & 1 deletion lib/testcase/sparql/TestCasePositiveSyntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ export class TestCasePositiveSyntax implements ITestCaseSparql {
}

public async test(engine: IQueryEngine, injectArguments: any): Promise<void> {
await engine.parse(this.queryString, injectArguments);
try {
await engine.parse(this.queryString, injectArguments);
} catch (e) {
throw new Error(`Expected not throw an error when parsing.
Input: ${this.queryString}
Error: ${e}
`);
}
return;
}

Expand Down

0 comments on commit 726438b

Please sign in to comment.