Chromium Code Reviews| 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'; | |
|
Brian Wilkerson
2016/09/09 13:49:35
If there were no references to anything imported f
| |
| 12 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 13 | 12 |
| 14 import 'domain_completion_test.dart'; | 13 import 'domain_completion_test.dart'; |
| 15 | 14 |
| 16 /** | 15 /** |
| 17 * A base class for classes containing completion tests. | 16 * A base class for classes containing completion tests. |
| 18 */ | 17 */ |
| 19 class CompletionTestCase extends CompletionDomainHandlerTest { | 18 class CompletionTestCase extends CompletionDomainHandlerTest { |
| 20 static const String CURSOR_MARKER = '!'; | 19 static const String CURSOR_MARKER = '!'; |
| 21 | 20 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 } | 154 } |
| 156 for (String result in validationStrings) { | 155 for (String result in validationStrings) { |
| 157 if (result.length < 3) { | 156 if (result.length < 3) { |
| 158 throw new StateError("Invalid location result: " + result); | 157 throw new StateError("Invalid location result: " + result); |
| 159 } | 158 } |
| 160 String id = result.substring(0, 1); | 159 String id = result.substring(0, 1); |
| 161 String sign = result.substring(1, 2); | 160 String sign = result.substring(1, 2); |
| 162 String value = result.substring(2); | 161 String value = result.substring(2); |
| 163 LocationSpec test = tests[id]; | 162 LocationSpec test = tests[id]; |
| 164 if (test == null) { | 163 if (test == null) { |
| 165 throw new StateError( | 164 throw new StateError("Invalid location result id: $id for: $result"); |
| 166 "Invalid location result id: $id for: $result"); | |
| 167 } | 165 } |
| 168 test.source = modifiedSource; | 166 test.source = modifiedSource; |
| 169 if (sign == '+') { | 167 if (sign == '+') { |
| 170 test.positiveResults.add(value); | 168 test.positiveResults.add(value); |
| 171 } else if (sign == '-') { | 169 } else if (sign == '-') { |
| 172 test.negativeResults.add(value); | 170 test.negativeResults.add(value); |
| 173 } else { | 171 } else { |
| 174 String err = "Invalid location result sign: $sign for: $result"; | 172 String err = "Invalid location result sign: $sign for: $result"; |
| 175 throw new StateError(err); | 173 throw new StateError(err); |
| 176 } | 174 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 198 err.write("No results for tests:"); | 196 err.write("No results for tests:"); |
| 199 for (String ch in badResults) { | 197 for (String ch in badResults) { |
| 200 err..write(' ')..write(ch); | 198 err..write(' ')..write(ch); |
| 201 } | 199 } |
| 202 } | 200 } |
| 203 throw new StateError(err.toString()); | 201 throw new StateError(err.toString()); |
| 204 } | 202 } |
| 205 return tests.values.toList(); | 203 return tests.values.toList(); |
| 206 } | 204 } |
| 207 } | 205 } |
| OLD | NEW |