-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
fix(fe): don't report missing else
for bad if
expression
#1101
fix(fe): don't report missing else
for bad if
expression
#1101
Conversation
9a706ea
to
1bbf3f5
Compare
I fixed my original mistake in test |
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.
Looks great! Let me know if you want to make changes or if I should merge it now.
test/test-parse-statement.cpp
Outdated
@@ -717,6 +717,25 @@ TEST_F(Test_Parse_Statement, else_without_if) { | |||
"visit_exit_block_scope", | |||
})); | |||
} | |||
|
|||
{ |
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 test case is inside Test_Parse_Statement.else_without_if, but this test case is an else
with and if
. I think you should make a separate TEST_F
. Perhaps Test_Parse_Statement.if_else_with_malformed_condition
? (Naming is hard.)
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.
Thanks for catching that. I moved the new test into a separate TEST_F
with the name you suggest.
@@ -320,8 +320,9 @@ TEST_F(Test_Parse, utter_garbage) { | |||
assert_diagnostics( |
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.
Not your patch: I probably should have documented why I introduced this test in the first place. 😅 It's probably just testing a crash, so changing the diagnostics sounds fine to me.
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.
It's related to issue #88 based on the Git log, and it is testing a crash.
1bbf3f5
to
cf3b314
Compare
If you're pleased with the most recent changes then you can merge. |
Landed as Git commit 9565209. |
This one line change (potentially) closes #1008. However, test
Test_Parse.utter_garbage
fails -- despite my edits. I don't understand the reason it fails either. To me, it appears like the conditions the test asserts hold true.The issue provides this snippet of code.
For convenience, the CLI version of quick-lint-js behaves like so before this change for the snippet of code provided in the issue.
With the change, it behaves like this.
For test
Test_Parse.utter_garbage
that it currently fails, the program produces this output.But it appears like all the expected diagnoses appear in the actual results, no? A element corresponds to each matcher.