forked from protofire/solhint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report parse errors instead of throwing an exception
Fixes protofire#245
- Loading branch information
Thomas Scholtes
committed
Aug 7, 2020
1 parent
285a83f
commit acc957c
Showing
2 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const assert = require('assert') | ||
const { assertErrorCount } = require('./common/asserts') | ||
const linter = require('./../lib/index') | ||
|
||
describe('Parse error', () => { | ||
it('should report parse errors', () => { | ||
const report = linter.processStr('contract Foo {', {}) | ||
|
||
assertErrorCount(report, 1) | ||
const error = report.reports[0] | ||
assert.equal(error.line, 1) | ||
assert.equal(error.column, 14) | ||
assert.ok(error.message.startsWith("Parse error: mismatched input '<EOF>'")) | ||
}) | ||
}) |