[analysis_server] Ensure context messages have an integration test for legacy
Fixes https://github.com/dart-lang/sdk/issues/44907 Change-Id: I2535f7ebf24da4abea21e32eff58087925d45345 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464540 Reviewed-by: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
committed by
Commit Queue
parent
a56cd8c261
commit
cb03b3ca2c
@@ -118,6 +118,30 @@ void f() {
|
||||
expect(currentAnalysisErrors[fileToDeletePath], isNotNull);
|
||||
}
|
||||
|
||||
Future<void> test_contextMessage() async {
|
||||
var pathname = sourcePath('test.dart');
|
||||
writeFile(pathname, '''
|
||||
void f() {
|
||||
x = 0;
|
||||
int x = 1;
|
||||
x;
|
||||
}''');
|
||||
await standardAnalysisSetup();
|
||||
|
||||
await analysisFinished;
|
||||
expect(currentAnalysisErrors[pathname], isList);
|
||||
var errors = existingErrorsForFile(pathname);
|
||||
var error = errors.single;
|
||||
expect(
|
||||
error.message,
|
||||
"Local variable 'x' can't be referenced before it is declared.",
|
||||
);
|
||||
expect(
|
||||
error.contextMessages!.single.message,
|
||||
"The declaration of 'x' is here.",
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> test_detect_simple_error() async {
|
||||
var pathname = sourcePath('test.dart');
|
||||
writeFile(pathname, '''
|
||||
|
||||
Reference in New Issue
Block a user