Prepare bots for not reporting UNUSED_IMPORT in presence of unresolved identifiers. (#154514)
With https://dart-review.googlesource.com/c/sdk/+/383022 the analyzer does not report `unused_import` when there are compilation errors potentially related to imports. https://github.com/flutter/flutter/issues/154413
This commit is contained in:
parent
3fd27bdb58
commit
284d289425
@ -38,7 +38,8 @@ const List<String> expectedUiErrors = <String>[
|
||||
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (unused_field)',
|
||||
];
|
||||
|
||||
final RegExp errorPrefixRE = RegExp(r'^([-a-z0-9/_.:]+): .*(\([-a-z_ ]+\) \([-a-z_ ]+\))$');
|
||||
final RegExp errorPrefixRE =
|
||||
RegExp(r'^([-a-z0-9/_.:]+): .*(\([-a-z_ ]+\) \([-a-z_ ]+\))$');
|
||||
String removeLintDescriptions(String error) {
|
||||
final RegExpMatch? match = errorPrefixRE.firstMatch(error);
|
||||
if (match != null) {
|
||||
@ -67,8 +68,10 @@ void main() {
|
||||
);
|
||||
expect(process.stdout, isEmpty);
|
||||
final List<String> stderrLines = process.stderr.toString().split('\n');
|
||||
expect(stderrLines.length, stderrLines.toSet().length, reason: 'found duplicates in $stderrLines');
|
||||
final List<String> stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList();
|
||||
expect(stderrLines.length, stderrLines.toSet().length,
|
||||
reason: 'found duplicates in $stderrLines');
|
||||
final List<String> stderrNoDescriptions =
|
||||
stderrLines.map(removeLintDescriptions).toList();
|
||||
expect(stderrNoDescriptions, <String>[
|
||||
...expectedMainErrors,
|
||||
'Found 18 snippet code errors.',
|
||||
@ -76,7 +79,7 @@ void main() {
|
||||
'', // because we end with a newline, split gives us an extra blank line
|
||||
]);
|
||||
expect(process.exitCode, 1);
|
||||
});
|
||||
}, skip: true); // TODO(scheglov): Restore after landing Dart SDK changes, https://github.com/flutter/flutter/issues/154413
|
||||
|
||||
test('Analyzes dart:ui code', () {
|
||||
final ProcessResult process = Process.runSync(
|
||||
@ -90,8 +93,10 @@ void main() {
|
||||
);
|
||||
expect(process.stdout, isEmpty);
|
||||
final List<String> stderrLines = process.stderr.toString().split('\n');
|
||||
expect(stderrLines.length, stderrLines.toSet().length, reason: 'found duplicates in $stderrLines');
|
||||
final List<String> stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList();
|
||||
expect(stderrLines.length, stderrLines.toSet().length,
|
||||
reason: 'found duplicates in $stderrLines');
|
||||
final List<String> stderrNoDescriptions =
|
||||
stderrLines.map(removeLintDescriptions).toList();
|
||||
expect(stderrNoDescriptions, <String>[
|
||||
...expectedUiErrors,
|
||||
...expectedMainErrors,
|
||||
@ -100,5 +105,5 @@ void main() {
|
||||
'', // because we end with a newline, split gives us an extra blank line
|
||||
]);
|
||||
expect(process.exitCode, 1);
|
||||
});
|
||||
}, skip: true); // TODO(scheglov): Restore after landing Dart SDK changes, https://github.com/flutter/flutter/issues/154413
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user