-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Update integration tests for Rust and error groups #1433
Conversation
Since the introduction of the `group` slot for `flycheck-error`, the checkers in `flycheck-ert` hadn't been updated. That meant that tests for languages which used groups were failing (i.e., rust tests). This commit takes the `group` slot into account when checking `flycheck-error` objects against expected errors.
Since GH-1427, errors from other files are included in the current buffer. So they must be included in the integration tests. In the case of Rust, macro errors emit diagnostics with a phony file, so we now filter these errors to prevent them from appearing in the buffer.
This looks very nice, thanks.
What about using consecutive numbers for groups? That is, use |
I think that would work. I went for symbols first because that was the easiest way to avoid collisions. If we use consecutive numbers, then we risk collisions since I think it should be okay for Rust currently, since we can only have one Rust checker active at at time. |
Good point. What about using "rustc-%d"? Alternatively, should flycheck-related-errors group by group id and checker? |
It's probably best, yes! Also what version of |
I see it in both seq-24 and seq on master |
Yeah I see it on master but not in |
Indeed. I see it in |
And also in 2.12 |
Ah, there is an unforeseen issue with using consecutive numbers. Cargo may call multiple compilation target in parallel, and the order of the diagnostics may not be the same at every run. For instance, I'm seeing runs with groups |
Hmm, I don't understand too well. You mean that the output of cargo-check isn't deterministic? :/ |
Awesome, thanks for picking this up! |
Also add a test for this function.
For the same file, it will always return errors in the same order, but since Since now we do not filter errors from other files, it seems predicting the |
OK, understood. Your approach of stripping the group ids might be the best, then. The only other approach I can think of is to use one of the errors in a group as the group identifier (think union-find). |
That could be interesting, yes. I might try that. |
I tried to use the first error of a group as the value for the It's possible to group the expected errors together, to avoid spelling out the
In We could use the circular notation instead:
But this does not work either, since This leaves us with coming up with a special marker to distinguish the reprensentative error (the one used as the But at this point, I feel the original solution of stripping groups was more straightforward, especially as it does not involve changing the syntax of the tests. |
Yes, I agree entirely. |
Please do review and merge then :) |
@cpitclaudel Thanks! |
See individual commit messages for an overview.
Implementation note: Currently the
group
property, as used by therustc
parser is populated withmake-symbol
values. This makes testing these values difficult usingequal
. I've worked around the issue by doing the comparison on copies of errors that havegroup
set to nil, and added a second check usingflycheck-related-errors
.The better solution would be to use
group
values that can be checked against in the integration tests. Or somehow redefineequal
to optionally disregard thegroup
slot. I'm open to suggestions.