-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring parser tests #1237
Refactoring parser tests #1237
Conversation
@bugarela, this test fails in a weird way. I guess, it is the result of recent refactoring. What shall we do about it?
|
This is the same problem I've been mentioning, that should be fixed by #1228. I'm working on the debug error messages for that and then we can merge it (I believe), thus unblocking this. Alternatively, we can comment out the invalid |
@konnov I merged my PR and updated this branch, and the error is gone. Now there is only a mismatch in the error message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a great improvement on readability and maintainability, thanks! It does make the tests weaker, and I'm specially concerned about testing if we are highlighting the correct portion of the code. Perhaps we can use the reportError
facility and then compare the text with ^^
symbols, instead of looking at the locs.
Anyway, I think this is much better than what we had before and we can iterate on further improvements later!
describe('syntax errors', () => { | ||
it('unbalanced module definition', () => { | ||
const code = 'module empty {' | ||
const errors = parseErrorsFrom('module-unbalanced', code) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this source name parameter fixed so a value? I don't see why we need to name the source name for every test differently
Co-authored-by: Gabriela Moreira <[email protected]>
Towards #17. I have carved out an important piece of refactoring from #1221: Instead of testing error messages via the JSON output, test them directly in unit tests. This significantly improves our parser tests:
I have only refactored the tests of phase 1. We should understand whether we want to refactor the remaining phases the same way.