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 c033718da0, 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.
This commit is contained in:
Sam Rawlins 2023-11-10 09:38:56 -08:00 committed by GitHub
parent cdc873ec7d
commit 33c0f27464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: <String>['analyze', '--no-pub'],
statusTextContains: <String>[
'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,
);
});