| 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.search.top_level_declarations; | 5 library test.search.top_level_declarations; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
| 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 12 | 12 |
| 13 import '../utils.dart'; | |
| 14 import 'abstract_search_domain.dart'; | 13 import 'abstract_search_domain.dart'; |
| 15 | 14 |
| 16 main() { | 15 main() { |
| 17 initializeTestEnvironment(); | |
| 18 defineReflectiveSuite(() { | 16 defineReflectiveSuite(() { |
| 19 defineReflectiveTests(TopLevelDeclarationsTest); | 17 defineReflectiveTests(TopLevelDeclarationsTest); |
| 20 }); | 18 }); |
| 21 } | 19 } |
| 22 | 20 |
| 23 @reflectiveTest | 21 @reflectiveTest |
| 24 class TopLevelDeclarationsTest extends AbstractSearchDomainTest { | 22 class TopLevelDeclarationsTest extends AbstractSearchDomainTest { |
| 25 void assertHasDeclaration(ElementKind kind, String name) { | 23 void assertHasDeclaration(ElementKind kind, String name) { |
| 26 result = findTopLevelResult(kind, name); | 24 result = findTopLevelResult(kind, name); |
| 27 if (result == null) { | 25 if (result == null) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 '''); | 73 '''); |
| 76 await findTopLevelDeclarations('^[A-E]\$'); | 74 await findTopLevelDeclarations('^[A-E]\$'); |
| 77 assertHasDeclaration(ElementKind.CLASS, 'A'); | 75 assertHasDeclaration(ElementKind.CLASS, 'A'); |
| 78 assertHasDeclaration(ElementKind.CLASS, 'B'); | 76 assertHasDeclaration(ElementKind.CLASS, 'B'); |
| 79 assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C'); | 77 assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C'); |
| 80 assertHasDeclaration(ElementKind.FUNCTION, 'D'); | 78 assertHasDeclaration(ElementKind.FUNCTION, 'D'); |
| 81 assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E'); | 79 assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E'); |
| 82 assertNoDeclaration(ElementKind.CLASS, 'ABC'); | 80 assertNoDeclaration(ElementKind.CLASS, 'ABC'); |
| 83 } | 81 } |
| 84 } | 82 } |
| OLD | NEW |