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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 SearchResult findTopLevelResult(ElementKind kind, String name) { | 49 SearchResult findTopLevelResult(ElementKind kind, String name) { |
50 for (SearchResult result in results) { | 50 for (SearchResult result in results) { |
51 Element element = result.path[0]; | 51 Element element = result.path[0]; |
52 if (element.kind == kind && element.name == name) { | 52 if (element.kind == kind && element.name == name) { |
53 return result; | 53 return result; |
54 } | 54 } |
55 } | 55 } |
56 return null; | 56 return null; |
57 } | 57 } |
58 | 58 |
| 59 @override |
| 60 void setUp() { |
| 61 enableNewAnalysisDriver = true; |
| 62 super.setUp(); |
| 63 } |
| 64 |
59 test_invalidRegex() async { | 65 test_invalidRegex() async { |
60 var result = await findTopLevelDeclarations('[A'); | 66 var result = await findTopLevelDeclarations('[A'); |
61 expect(result, new isInstanceOf<RequestError>()); | 67 expect(result, new isInstanceOf<RequestError>()); |
62 } | 68 } |
63 | 69 |
64 test_startEndPattern() async { | 70 test_startEndPattern() async { |
65 addTestFile(''' | 71 addTestFile(''' |
66 class A {} // A | 72 class A {} // A |
67 class B = Object with A; | 73 class B = Object with A; |
68 typedef C(); | 74 typedef C(); |
69 D() {} | 75 D() {} |
70 var E = null; | 76 var E = null; |
71 class ABC {} | 77 class ABC {} |
72 '''); | 78 '''); |
73 await findTopLevelDeclarations('^[A-E]\$'); | 79 await findTopLevelDeclarations('^[A-E]\$'); |
74 assertHasDeclaration(ElementKind.CLASS, 'A'); | 80 assertHasDeclaration(ElementKind.CLASS, 'A'); |
75 assertHasDeclaration(ElementKind.CLASS, 'B'); | 81 assertHasDeclaration(ElementKind.CLASS, 'B'); |
76 assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C'); | 82 assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C'); |
77 assertHasDeclaration(ElementKind.FUNCTION, 'D'); | 83 assertHasDeclaration(ElementKind.FUNCTION, 'D'); |
78 assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E'); | 84 assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E'); |
79 assertNoDeclaration(ElementKind.CLASS, 'ABC'); | 85 assertNoDeclaration(ElementKind.CLASS, 'ABC'); |
80 } | 86 } |
81 } | 87 } |
OLD | NEW |