mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
bulk fix for unawaited_futures
Change-Id: I0d53fe9d31b22a08585ea625a5dfbbf5ed5187e5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158104 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
parent
94be2fc1f8
commit
b989ccf733
|
@ -8,6 +8,7 @@ import 'dart:core';
|
|||
import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
|
||||
import 'package:analysis_server/src/services/correction/change_workspace.dart';
|
||||
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
|
||||
import 'package:analysis_server/src/services/correction/dart/add_await.dart';
|
||||
import 'package:analysis_server/src/services/correction/dart/add_override.dart';
|
||||
import 'package:analysis_server/src/services/correction/dart/convert_add_all_to_spread.dart';
|
||||
import 'package:analysis_server/src/services/correction/dart/convert_conditional_expression_to_if_element.dart';
|
||||
|
@ -88,6 +89,7 @@ class BulkFixProcessor {
|
|||
LintNames.prefer_spread_collections: ConvertAddAllToSpread.newInstance,
|
||||
LintNames.slash_for_doc_comments: ConvertDocumentationIntoLine.newInstance,
|
||||
LintNames.type_init_formals: RemoveTypeAnnotation.newInstance,
|
||||
LintNames.unawaited_futures: AddAwait.newInstance,
|
||||
LintNames.unnecessary_const: RemoveUnnecessaryConst.newInstance,
|
||||
LintNames.unnecessary_lambdas: ReplaceWithTearOff.newInstance,
|
||||
LintNames.unnecessary_new: RemoveUnnecessaryNew.newInstance,
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analysis_server/src/services/linter/lint_names.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import 'bulk_fix_processor.dart';
|
||||
|
||||
void main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(AddAwaitTest);
|
||||
});
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class AddAwaitTest extends BulkFixProcessorTest {
|
||||
@override
|
||||
String get lintCode => LintNames.unawaited_futures;
|
||||
|
||||
Future<void> test_singleFile() async {
|
||||
await resolveTestUnit('''
|
||||
Future doSomething() => new Future.value('');
|
||||
Future doSomethingElse() => new Future.value('');
|
||||
|
||||
void main() async {
|
||||
doSomething();
|
||||
doSomethingElse();
|
||||
}
|
||||
''');
|
||||
await assertHasFix('''
|
||||
Future doSomething() => new Future.value('');
|
||||
Future doSomethingElse() => new Future.value('');
|
||||
|
||||
void main() async {
|
||||
await doSomething();
|
||||
await doSomethingElse();
|
||||
}
|
||||
''');
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import 'add_await_test.dart' as add_await;
|
||||
import 'add_override_test.dart' as add_override;
|
||||
import 'convert_documentation_into_line_test.dart'
|
||||
as convert_documentation_into_line;
|
||||
|
@ -41,6 +42,7 @@ import 'use_is_not_empty_test.dart' as use_is_not_empty;
|
|||
|
||||
void main() {
|
||||
defineReflectiveSuite(() {
|
||||
add_await.main();
|
||||
add_override.main();
|
||||
convert_documentation_into_line.main();
|
||||
convert_to_contains.main();
|
||||
|
|
Loading…
Reference in a new issue