| 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 | |
| 65 test_invalidRegex() async { | 59 test_invalidRegex() async { |
| 66 var result = await findTopLevelDeclarations('[A'); | 60 var result = await findTopLevelDeclarations('[A'); |
| 67 expect(result, new isInstanceOf<RequestError>()); | 61 expect(result, new isInstanceOf<RequestError>()); |
| 68 } | 62 } |
| 69 | 63 |
| 70 test_startEndPattern() async { | 64 test_startEndPattern() async { |
| 71 addTestFile(''' | 65 addTestFile(''' |
| 72 class A {} // A | 66 class A {} // A |
| 73 class B = Object with A; | 67 class B = Object with A; |
| 74 typedef C(); | 68 typedef C(); |
| 75 D() {} | 69 D() {} |
| 76 var E = null; | 70 var E = null; |
| 77 class ABC {} | 71 class ABC {} |
| 78 '''); | 72 '''); |
| 79 await findTopLevelDeclarations('^[A-E]\$'); | 73 await findTopLevelDeclarations('^[A-E]\$'); |
| 80 assertHasDeclaration(ElementKind.CLASS, 'A'); | 74 assertHasDeclaration(ElementKind.CLASS, 'A'); |
| 81 assertHasDeclaration(ElementKind.CLASS, 'B'); | 75 assertHasDeclaration(ElementKind.CLASS, 'B'); |
| 82 assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C'); | 76 assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C'); |
| 83 assertHasDeclaration(ElementKind.FUNCTION, 'D'); | 77 assertHasDeclaration(ElementKind.FUNCTION, 'D'); |
| 84 assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E'); | 78 assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E'); |
| 85 assertNoDeclaration(ElementKind.CLASS, 'ABC'); | 79 assertNoDeclaration(ElementKind.CLASS, 'ABC'); |
| 86 } | 80 } |
| 87 } | 81 } |
| OLD | NEW |