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

Unified Diff: pkg/analysis_server/test/edit/assists_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 | « no previous file | pkg/analysis_server/test/edit/fixes_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/edit/assists_test.dart
diff --git a/pkg/analysis_server/test/edit/assists_test.dart b/pkg/analysis_server/test/edit/assists_test.dart
index a24a0487d9dc9724ce32f28dba095086dc43a274..35174166e6de651813945a0ce2cffeb4b38a4bd1 100644
--- a/pkg/analysis_server/test/edit/assists_test.dart
+++ b/pkg/analysis_server/test/edit/assists_test.dart
@@ -47,51 +47,49 @@ class AssistsTest extends AbstractAnalysisTest {
handler = new EditDomainHandler(server, plugin);
}
- Future test_removeTypeAnnotation() {
+ Future test_removeTypeAnnotation() async {
addTestFile('''
main() {
int v = 1;
}
''');
- return waitForTasksFinished().then((_) {
- prepareAssists('v =');
- _assertHasChange('Remove type annotation', '''
+ await waitForTasksFinished();
+ prepareAssists('v =');
+ _assertHasChange('Remove type annotation', '''
main() {
var v = 1;
}
''');
- });
}
- Future test_splitVariableDeclaration() {
+ Future test_splitVariableDeclaration() async {
addTestFile('''
main() {
int v = 1;
}
''');
- return waitForTasksFinished().then((_) {
- prepareAssists('v =');
- _assertHasChange('Split variable declaration', '''
+ await waitForTasksFinished();
+ prepareAssists('v =');
+ _assertHasChange('Split variable declaration', '''
main() {
int v;
v = 1;
}
''');
- });
}
- Future test_surroundWithIf() {
+ Future test_surroundWithIf() async {
addTestFile('''
main() {
print(1);
print(2);
}
''');
- return waitForTasksFinished().then((_) {
- int offset = findOffset(' print(1)');
- int length = findOffset('}') - offset;
- prepareAssistsAt(offset, length);
- _assertHasChange("Surround with 'if'", '''
+ await waitForTasksFinished();
+ int offset = findOffset(' print(1)');
+ int length = findOffset('}') - offset;
+ prepareAssistsAt(offset, length);
+ _assertHasChange("Surround with 'if'", '''
main() {
if (condition) {
print(1);
@@ -99,7 +97,6 @@ main() {
}
}
''');
- });
}
void _assertHasChange(String message, String expectedCode) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/edit/fixes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698