From 284d289425e4f5375ee1524f09c4e066b100cdf5 Mon Sep 17 00:00:00 2001 From: Konstantin Scheglov Date: Tue, 3 Sep 2024 14:16:48 -0700 Subject: [PATCH] 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 --- dev/bots/test/analyze_snippet_code_test.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dev/bots/test/analyze_snippet_code_test.dart b/dev/bots/test/analyze_snippet_code_test.dart index 900456c442..bb55be94ae 100644 --- a/dev/bots/test/analyze_snippet_code_test.dart +++ b/dev/bots/test/analyze_snippet_code_test.dart @@ -38,7 +38,8 @@ const List expectedUiErrors = [ '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 stderrLines = process.stderr.toString().split('\n'); - expect(stderrLines.length, stderrLines.toSet().length, reason: 'found duplicates in $stderrLines'); - final List stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList(); + expect(stderrLines.length, stderrLines.toSet().length, + reason: 'found duplicates in $stderrLines'); + final List stderrNoDescriptions = + stderrLines.map(removeLintDescriptions).toList(); expect(stderrNoDescriptions, [ ...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 stderrLines = process.stderr.toString().split('\n'); - expect(stderrLines.length, stderrLines.toSet().length, reason: 'found duplicates in $stderrLines'); - final List stderrNoDescriptions = stderrLines.map(removeLintDescriptions).toList(); + expect(stderrLines.length, stderrLines.toSet().length, + reason: 'found duplicates in $stderrLines'); + final List stderrNoDescriptions = + stderrLines.map(removeLintDescriptions).toList(); expect(stderrNoDescriptions, [ ...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 }