| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.test_support; | 8 library engine.test_support; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| 11 import 'package:analyzer/src/generated/java_core.dart'; | 11 import 'package:analyzer/src/generated/java_core.dart'; |
| 12 import 'package:analyzer/src/generated/java_junit.dart'; | 12 import 'package:analyzer/src/generated/java_junit.dart'; |
| 13 import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/java_engine.dart'; |
| 14 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
| 15 import 'package:analyzer/src/generated/error.dart'; | 15 import 'package:analyzer/src/generated/error.dart'; |
| 16 import 'package:analyzer/src/generated/scanner.dart'; | 16 import 'package:analyzer/src/generated/scanner.dart'; |
| 17 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; | 17 import 'package:analyzer/src/generated/ast.dart' show AstNode, NodeLocator; |
| 18 import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodE
lement, PropertyAccessorElement; | 18 import 'package:analyzer/src/generated/element.dart'; |
| 19 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 20 import 'package:unittest/unittest.dart' as _ut; | 20 import 'package:unittest/unittest.dart' as _ut; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * The class `EngineTestCase` defines utility methods for making assertions. | 23 * The class `EngineTestCase` defines utility methods for making assertions. |
| 24 */ | 24 */ |
| 25 class EngineTestCase extends JUnitTestCase { | 25 class EngineTestCase extends JUnitTestCase { |
| 26 static int _PRINT_RANGE = 6; | 26 static int _PRINT_RANGE = 6; |
| 27 | 27 |
| 28 /** | 28 /** |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 if (element == array[i]) { | 377 if (element == array[i]) { |
| 378 found[i] = true; | 378 found[i] = true; |
| 379 return; | 379 return; |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 JUnitTestCase.fail("Does not contain ${element}"); | 383 JUnitTestCase.fail("Does not contain ${element}"); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 | 386 |
| 387 /** |
| 388 * Assert that the given collection has the same number of elements as the num
ber of specified |
| 389 * names, and that for each specified name, a corresponding element can be fou
nd in the given |
| 390 * collection with that name. |
| 391 * |
| 392 * @param elements the elements |
| 393 * @param names the names |
| 394 */ |
| 395 void assertNamedElements(List<Element> elements, List<String> names) { |
| 396 for (String elemName in names) { |
| 397 bool found = false; |
| 398 for (Element elem in elements) { |
| 399 if (elem.name == elemName) { |
| 400 found = true; |
| 401 break; |
| 402 } |
| 403 } |
| 404 if (!found) { |
| 405 JavaStringBuilder msg = new JavaStringBuilder(); |
| 406 msg.append("Expected element named: "); |
| 407 msg.append(elemName); |
| 408 msg.append("\n but found: "); |
| 409 for (Element elem in elements) { |
| 410 msg.append(elem.name); |
| 411 msg.append(", "); |
| 412 } |
| 413 JUnitTestCase.fail(msg.toString()); |
| 414 } |
| 415 } |
| 416 assertLength(names.length, elements); |
| 417 } |
| 418 |
| 387 AnalysisContextImpl createAnalysisContext() { | 419 AnalysisContextImpl createAnalysisContext() { |
| 388 AnalysisContextImpl context = new AnalysisContextImpl(); | 420 AnalysisContextImpl context = new AnalysisContextImpl(); |
| 389 context.sourceFactory = new SourceFactory([]); | 421 context.sourceFactory = new SourceFactory([]); |
| 390 return context; | 422 return context; |
| 391 } | 423 } |
| 392 | 424 |
| 393 /** | 425 /** |
| 394 * Return the getter in the given type with the given name. Inherited getters
are ignored. | 426 * Return the getter in the given type with the given name. Inherited getters
are ignored. |
| 395 * | 427 * |
| 396 * @param type the type in which the getter is declared | 428 * @param type the type in which the getter is declared |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 UriKind get uriKind { | 899 UriKind get uriKind { |
| 868 throw new UnsupportedOperationException(); | 900 throw new UnsupportedOperationException(); |
| 869 } | 901 } |
| 870 Uri get uri { | 902 Uri get uri { |
| 871 throw new UnsupportedOperationException(); | 903 throw new UnsupportedOperationException(); |
| 872 } | 904 } |
| 873 TimestampedData<String> get contents { | 905 TimestampedData<String> get contents { |
| 874 throw new UnsupportedOperationException(); | 906 throw new UnsupportedOperationException(); |
| 875 } | 907 } |
| 876 } | 908 } |
| OLD | NEW |