OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 engine.declaration_resolver_test; | 5 library engine.declaration_resolver_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/src/dart/ast/ast.dart'; | 9 import 'package:analyzer/src/dart/ast/ast.dart'; |
10 import 'package:analyzer/src/dart/ast/utilities.dart'; | 10 import 'package:analyzer/src/dart/ast/utilities.dart'; |
11 import 'package:analyzer/src/generated/engine.dart'; | 11 import 'package:analyzer/src/generated/engine.dart'; |
12 import 'package:analyzer/src/generated/resolver.dart'; | 12 import 'package:analyzer/src/generated/resolver.dart'; |
13 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
14 import 'package:analyzer/src/task/dart.dart'; | 14 import 'package:analyzer/src/task/dart.dart'; |
15 import 'package:analyzer/task/dart.dart'; | 15 import 'package:analyzer/task/dart.dart'; |
| 16 import 'package:test/test.dart'; |
16 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
17 import 'package:unittest/unittest.dart'; | |
18 | 18 |
19 import '../utils.dart'; | 19 import '../utils.dart'; |
20 import 'resolver_test_case.dart'; | 20 import 'resolver_test_case.dart'; |
21 import 'test_support.dart'; | 21 import 'test_support.dart'; |
22 | 22 |
23 main() { | 23 main() { |
24 initializeTestEnvironment(); | 24 initializeTestEnvironment(); |
25 defineReflectiveTests(DeclarationResolverMetadataTest); | 25 defineReflectiveSuite(() { |
26 defineReflectiveTests(DeclarationResolverTest); | 26 defineReflectiveTests(DeclarationResolverMetadataTest); |
27 defineReflectiveTests(StrongModeDeclarationResolverTest); | 27 defineReflectiveTests(DeclarationResolverTest); |
| 28 defineReflectiveTests(StrongModeDeclarationResolverTest); |
| 29 }); |
28 } | 30 } |
29 | 31 |
30 CompilationUnit _cloneResolveUnit(CompilationUnit unit) { | 32 CompilationUnit _cloneResolveUnit(CompilationUnit unit) { |
31 CompilationUnit clonedUnit = AstCloner.clone(unit); | 33 CompilationUnit clonedUnit = AstCloner.clone(unit); |
32 new DeclarationResolver().resolve(clonedUnit, unit.element); | 34 new DeclarationResolver().resolve(clonedUnit, unit.element); |
33 return clonedUnit; | 35 return clonedUnit; |
34 } | 36 } |
35 | 37 |
36 SimpleIdentifier _findSimpleIdentifier( | 38 SimpleIdentifier _findSimpleIdentifier( |
37 AstNode root, String code, String search) { | 39 AstNode root, String code, String search) { |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 expect(element.type.toString(), "<T>(T, T) → T"); | 538 expect(element.type.toString(), "<T>(T, T) → T"); |
537 expect(t.element, same(tElement)); | 539 expect(t.element, same(tElement)); |
538 | 540 |
539 // re-resolve | 541 // re-resolve |
540 CompilationUnit unit2 = _cloneResolveUnit(unit); | 542 CompilationUnit unit2 = _cloneResolveUnit(unit); |
541 node = _findSimpleIdentifier(unit2, code, 'max').parent; | 543 node = _findSimpleIdentifier(unit2, code, 'max').parent; |
542 t = node.typeParameters.typeParameters[0]; | 544 t = node.typeParameters.typeParameters[0]; |
543 expect(t.element, same(tElement)); | 545 expect(t.element, same(tElement)); |
544 } | 546 } |
545 } | 547 } |
OLD | NEW |