Index: pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart |
diff --git a/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart b/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart |
index 18b8794e4a10061d9b0de3dc9616f5a097bf52fd..1b99cfed2f6992a0819587c184cf7ad930e2e456 100644 |
--- a/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart |
+++ b/pkg/analysis_server/test/services/completion/statement/statement_completion_test.dart |
@@ -24,67 +24,110 @@ class StatementCompletionTest extends AbstractSingleUnitTest { |
bool get enableNewAnalysisDriver => true; |
- test_completeIfEmptyCondition() async { |
+ test_completeDoEmptyCondition() async { |
await _prepareCompletion( |
- 'if ()', |
+ 'while ()', |
''' |
main() { |
- if () |
+ do { |
+ } while () |
} |
''', |
atEnd: true); |
_assertHasChange( |
- 'Complete if-statement', |
+ 'Complete do-statement', |
''' |
main() { |
- if () { |
- //// |
- } |
+ do { |
+ } while (); |
} |
''', |
- (s) => s.indexOf('if (') + 'if ('.length); |
+ (s) => s.indexOf('while (') + 'while ('.length); |
} |
- test_completeIfKeywordOnly() async { |
+ test_completeDoKeywordOnly() async { |
await _prepareCompletion( |
- 'if', |
+ 'do', |
''' |
main() { |
- if //// |
+ do //// |
} |
''', |
atEnd: true); |
_assertHasChange( |
- 'Complete if-statement', |
+ 'Complete do-statement', |
''' |
main() { |
- if () { |
+ do { |
//// |
- } |
+ } while (); |
} |
''', |
- (s) => s.indexOf('if (') + 'if ('.length); |
+ (s) => s.indexOf('while (') + 'while ('.length); |
} |
- test_completeIfWithCondition() async { |
+ test_completeDoNoBody() async { |
await _prepareCompletion( |
- 'if (tr', // Trigger completion from within expression. |
+ 'do', |
''' |
main() { |
- if (true) |
+ do; |
+ while |
} |
''', |
atEnd: true); |
_assertHasChange( |
- 'Complete if-statement', |
+ 'Complete do-statement', |
''' |
main() { |
- if (true) { |
+ do { |
//// |
+ } while (); |
+} |
+''', |
+ (s) => s.indexOf('while (') + 'while ('.length); |
+ } |
+ |
+ test_completeDoNoCondition() async { |
+ await _prepareCompletion( |
+ 'while', |
+ ''' |
+main() { |
+ do { |
+ } while |
+} |
+''', |
+ atEnd: true); |
+ _assertHasChange( |
+ 'Complete do-statement', |
+ ''' |
+main() { |
+ do { |
+ } while (); |
+} |
+''', |
+ (s) => s.indexOf('while (') + 'while ('.length); |
+ } |
+ |
+ test_completeDoNoWhile() async { |
+ await _prepareCompletion( |
+ '}', |
+ ''' |
+main() { |
+ do { |
} |
} |
''', |
- (s) => s.indexOf(' ') + ' '.length); |
+ atEnd: true); |
+ _assertHasChange( |
+ 'Complete do-statement', |
+ ''' |
+main() { |
+ do { |
+ } while (); |
+} |
+''', |
+ (s) => s.indexOf('while (') + 'while ('.length); |
} |
test_completeIfAfterCondition_BAD() async { |
@@ -113,6 +156,69 @@ main() { |
(s) => s.indexOf('if (true) ') + 'if (true) '.length); |
} |
+ test_completeIfEmptyCondition() async { |
+ await _prepareCompletion( |
+ 'if ()', |
+ ''' |
+main() { |
+ if () |
+} |
+''', |
+ atEnd: true); |
+ _assertHasChange( |
+ 'Complete if-statement', |
+ ''' |
+main() { |
+ if () { |
+ //// |
+ } |
+} |
+''', |
+ (s) => s.indexOf('if (') + 'if ('.length); |
+ } |
+ |
+ test_completeIfKeywordOnly() async { |
+ await _prepareCompletion( |
+ 'if', |
+ ''' |
+main() { |
+ if //// |
+} |
+''', |
+ atEnd: true); |
+ _assertHasChange( |
+ 'Complete if-statement', |
+ ''' |
+main() { |
+ if () { |
+ //// |
+ } |
+} |
+''', |
+ (s) => s.indexOf('if (') + 'if ('.length); |
+ } |
+ |
+ test_completeIfWithCondition() async { |
+ await _prepareCompletion( |
+ 'if (tr', // Trigger completion from within expression. |
+ ''' |
+main() { |
+ if (true) |
+} |
+''', |
+ atEnd: true); |
+ _assertHasChange( |
+ 'Complete if-statement', |
+ ''' |
+main() { |
+ if (true) { |
+ //// |
+ } |
+} |
+''', |
+ (s) => s.indexOf(' ') + ' '.length); |
+ } |
+ |
test_completeIfWithElse_BAD() async { |
await _prepareCompletion( |
'if ()', |