From 33c0f27464e84eec90f029160f87f95f39e79dc1 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Fri, 10 Nov 2023 09:38:56 -0800 Subject: [PATCH] Prepare the analyze_once test for removal of analysis_options_user support (#138229) Fixes https://github.com/flutter/flutter/issues/138227. Work towards https://github.com/flutter/flutter/issues/82948 In https://github.com/dart-lang/sdk/commit/c033718da0502ed92609f8c6cee2f6a59ccc058e, the analyzer's support for `analysis_options_user.yaml` is dropped. So no lint is reported in this test, as expected. This PR changes the test to expect no lint, and also no write the edits that trigger the lint. --- .../test/integration.shard/analyze_once_test.dart | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart index b9588a5555..200a47447f 100644 --- a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart +++ b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart @@ -164,16 +164,10 @@ void main() { // Analyze in the current directory - no arguments testWithoutContext('working directory with errors', () async { - // Break the code to produce the "Avoid empty else" hint - // that is upgraded to a warning in package:flutter/analysis_options_user.yaml - // to assert that we are using the default Flutter analysis options. + // Break the code to produce an error and a warning. // Also insert a statement that should not trigger a lint here // but will trigger a lint later on when an analysis_options.yaml is added. String source = await libMain.readAsString(); - source = source.replaceFirst( - 'return MaterialApp(', - 'if (debugPrintRebuildDirtyWidgets) {} else ; return MaterialApp(', - ); source = source.replaceFirst( 'onPressed: _incrementCounter,', '// onPressed: _incrementCounter,', @@ -189,12 +183,12 @@ void main() { arguments: ['analyze', '--no-pub'], statusTextContains: [ 'Analyzing', - 'avoid_empty_else', - 'empty_statements', 'unused_element', 'missing_required_param', ], - exitMessageContains: '4 issues found.', + // TODO(srawlins): Assert with `exitMessageContains: '2 issues found.',` after + // https://github.com/dart-lang/sdk/commit/c033718da0502ed92609f8c6cee2f6a59ccc058e + // rolls into this repo. exitCode: 1, ); });