Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: pkg/analysis_server/test/edit/fixes_test.dart

Issue 1140373002: Convert two tests to use async/await. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/edit/assists_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/edit/fixes_test.dart
diff --git a/pkg/analysis_server/test/edit/fixes_test.dart b/pkg/analysis_server/test/edit/fixes_test.dart
index 396c547a2691a6034dfe8f24e896b74981b55efb..595f1b313a2a03e0a2bde713e7d8d486dfdc56dd 100644
--- a/pkg/analysis_server/test/edit/fixes_test.dart
+++ b/pkg/analysis_server/test/edit/fixes_test.dart
@@ -34,26 +34,25 @@ class FixesTest extends AbstractAnalysisTest {
handler = new EditDomainHandler(server, plugin);
}
- Future test_fixUndefinedClass() {
+ Future test_fixUndefinedClass() async {
addTestFile('''
main() {
Future<String> x = null;
}
''');
- return waitForTasksFinished().then((_) {
- List<AnalysisErrorFixes> errorFixes = _getFixesAt('Future<String>');
- expect(errorFixes, hasLength(1));
- AnalysisError error = errorFixes[0].error;
- expect(error.severity, AnalysisErrorSeverity.WARNING);
- expect(error.type, AnalysisErrorType.STATIC_WARNING);
- List<SourceChange> fixes = errorFixes[0].fixes;
- expect(fixes, hasLength(2));
- expect(fixes[0].message, matches('Import library'));
- expect(fixes[1].message, matches('Create class'));
- });
+ await waitForTasksFinished();
+ List<AnalysisErrorFixes> errorFixes = _getFixesAt('Future<String>');
+ expect(errorFixes, hasLength(1));
+ AnalysisError error = errorFixes[0].error;
+ expect(error.severity, AnalysisErrorSeverity.WARNING);
+ expect(error.type, AnalysisErrorType.STATIC_WARNING);
+ List<SourceChange> fixes = errorFixes[0].fixes;
+ expect(fixes, hasLength(2));
+ expect(fixes[0].message, matches('Import library'));
+ expect(fixes[1].message, matches('Create class'));
}
- Future test_hasFixes() {
+ Future test_hasFixes() async {
addTestFile('''
foo() {
print(1)
@@ -62,24 +61,23 @@ bar() {
print(10) print(20)
}
''');
- return waitForTasksFinished().then((_) {
- // print(1)
- {
- List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(1)');
- expect(errorFixes, hasLength(1));
- _isSyntacticErrorWithSingleFix(errorFixes[0]);
- }
- // print(10)
- {
- List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(10)');
- expect(errorFixes, hasLength(2));
- _isSyntacticErrorWithSingleFix(errorFixes[0]);
- _isSyntacticErrorWithSingleFix(errorFixes[1]);
- }
- });
+ await waitForTasksFinished();
+ // print(1)
+ {
+ List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(1)');
+ expect(errorFixes, hasLength(1));
+ _isSyntacticErrorWithSingleFix(errorFixes[0]);
+ }
+ // print(10)
+ {
+ List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(10)');
+ expect(errorFixes, hasLength(2));
+ _isSyntacticErrorWithSingleFix(errorFixes[0]);
+ _isSyntacticErrorWithSingleFix(errorFixes[1]);
+ }
}
- Future test_overlayOnlyFile() {
+ Future test_overlayOnlyFile() async {
// add an overlay-only file
{
testCode = '''
@@ -94,11 +92,10 @@ main() {
expect(response, isResponseSuccess('0'));
}
// ask for fixes
- return waitForTasksFinished().then((_) {
- List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(1)');
- expect(errorFixes, hasLength(1));
- _isSyntacticErrorWithSingleFix(errorFixes[0]);
- });
+ await waitForTasksFinished();
+ List<AnalysisErrorFixes> errorFixes = _getFixesAt('print(1)');
+ expect(errorFixes, hasLength(1));
+ _isSyntacticErrorWithSingleFix(errorFixes[0]);
}
List<AnalysisErrorFixes> _getFixes(int offset) {
« no previous file with comments | « pkg/analysis_server/test/edit/assists_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698