| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/src/dart/analysis/referenced_names.dart'; | 6 import 'package:analyzer/src/dart/analysis/referenced_names.dart'; |
| 7 import 'package:test/test.dart'; | 7 import 'package:test/test.dart'; |
| 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 9 | 9 |
| 10 import '../../../generated/parser_test.dart'; | 10 import '../../../generated/parser_test.dart'; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 defineReflectiveSuite(() { | 13 defineReflectiveSuite(() { |
| 14 defineReflectiveTests(ReferencedNamesBuilderTest); | 14 defineReflectiveTests(ReferencedNamesBuilderTest); |
| 15 }); | 15 }); |
| 16 } | 16 } |
| 17 | 17 |
| 18 @reflectiveTest | 18 @reflectiveTest |
| 19 class ReferencedNamesBuilderTest { | 19 class ReferencedNamesBuilderTest extends ParserTestCase { |
| 20 test_class_constructor() { | 20 test_class_constructor() { |
| 21 Set<String> names = _computeReferencedNames(''' | 21 Set<String> names = _computeReferencedNames(''' |
| 22 class U { | 22 class U { |
| 23 U.named(A a, B b) { | 23 U.named(A a, B b) { |
| 24 C c = null; | 24 C c = null; |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 '''); | 27 '''); |
| 28 expect(names, unorderedEquals(['A', 'B', 'C'])); | 28 expect(names, unorderedEquals(['A', 'B', 'C'])); |
| 29 } | 29 } |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 L5; | 376 L5; |
| 377 L6; | 377 L6; |
| 378 L7; | 378 L7; |
| 379 L8; | 379 L8; |
| 380 } | 380 } |
| 381 '''); | 381 '''); |
| 382 expect(names, unorderedEquals(['A', 'B', 'C'])); | 382 expect(names, unorderedEquals(['A', 'B', 'C'])); |
| 383 } | 383 } |
| 384 | 384 |
| 385 Set<String> _computeReferencedNames(String code) { | 385 Set<String> _computeReferencedNames(String code) { |
| 386 CompilationUnit unit = ParserTestCase.parseCompilationUnit2(code); | 386 CompilationUnit unit = parseCompilationUnit2(code); |
| 387 return computeReferencedNames(unit); | 387 return computeReferencedNames(unit); |
| 388 } | 388 } |
| 389 } | 389 } |
| OLD | NEW |