| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.completion.support; | 5 library test.completion.support; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 11 import 'package:analyzer/src/generated/java_core.dart'; | 11 import 'package:analyzer/src/generated/java_core.dart'; |
| 12 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
| 13 | 13 |
| 14 import 'domain_completion_test.dart'; | 14 import 'domain_completion_test.dart'; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * A base class for classes containing completion tests. | 17 * A base class for classes containing completion tests. |
| 18 */ | 18 */ |
| 19 class CompletionTestCase extends CompletionTest { | 19 class CompletionTestCase extends CompletionDomainHandlerTest { |
| 20 static const String CURSOR_MARKER = '!'; | 20 static const String CURSOR_MARKER = '!'; |
| 21 | 21 |
| 22 List get suggestedCompletions => suggestions | 22 List get suggestedCompletions => suggestions |
| 23 .map((CompletionSuggestion suggestion) => suggestion.completion) | 23 .map((CompletionSuggestion suggestion) => suggestion.completion) |
| 24 .toList(); | 24 .toList(); |
| 25 | 25 |
| 26 void assertHasCompletion(String completion) { | 26 void assertHasCompletion(String completion) { |
| 27 int expectedOffset = completion.indexOf(CURSOR_MARKER); | 27 int expectedOffset = completion.indexOf(CURSOR_MARKER); |
| 28 if (expectedOffset >= 0) { | 28 if (expectedOffset >= 0) { |
| 29 if (completion.indexOf(CURSOR_MARKER, expectedOffset + 1) >= 0) { | 29 if (completion.indexOf(CURSOR_MARKER, expectedOffset + 1) >= 0) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 err.write("No results for tests:"); | 198 err.write("No results for tests:"); |
| 199 for (String ch in badResults) { | 199 for (String ch in badResults) { |
| 200 err..write(' ')..write(ch); | 200 err..write(' ')..write(ch); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 throw new IllegalStateException(err.toString()); | 203 throw new IllegalStateException(err.toString()); |
| 204 } | 204 } |
| 205 return tests.values.toList(); | 205 return tests.values.toList(); |
| 206 } | 206 } |
| 207 } | 207 } |
| OLD | NEW |