-
Notifications
You must be signed in to change notification settings - Fork 212
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
Support for static diagnostic tests for macros #2183
Comments
We might want to build this as a separate package. We could start with a manual integration with the test runner. // test/diagnostics_test.dart
import 'package:diagnostics_tests/diagnostic_tests.dart';
void main() {
runDiagnosticsTests('path/to/directory');
}
After we are confident the API is stable we could consider integrating it into |
A different package, at least to start, I think makes sense. Another thing to consider here is that diagnostics can be emitted inside of macro generated code too, so we would have to figure out how that should be expressed. |
Another note here is that the way existing language tests work can be frustrating because your IDE will also report all the errors, for all the tests, in the problems view. It is useful when looking at the actual error test to see the actual diagnostics in line, but it can also clutter the problems view a lot. It would be nice to somehow get errors inline, but not in the problems view, and also when running |
I don't think this is feasible. IIRC the server gives a list of diagnostics, but doesn't control how the IDE displays them in the source or other views. I don't think we can mark a diagnostic to excluded it from the problems view. |
I'm expecting that we'll have a test framework for plugin authors that looks more like the style of tests that we use in the analysis server. While something like this might be sufficient for diagnostics, I don't think it would be a great fit for testing other IDE features, such as quick fixes. |
Macros can emit diagnostics, of varying severity. In the SDK repo, we have language tests for validating diagnostics that we expect compilers to report, and I think they generally work fairly well.
It would be interesting to explore a similar functionality, but for macro authors, and potentially analyzer plugin authors as well.
I haven't put much thought into how they would work exactly, but possibly some metadata could be used to annotate a test as not being executable, and instead being a "static diagnostic test". And we would either re-use the existing syntax for the SDK tests or invent something with similar functionality.
WDYT @natebosch ?
The text was updated successfully, but these errors were encountered: