| 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.domain.search; | 5 library test.domain.search; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return createLocalMemoryIndex(); | 85 return createLocalMemoryIndex(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 @override | 88 @override |
| 89 void setUp() { | 89 void setUp() { |
| 90 super.setUp(); | 90 super.setUp(); |
| 91 index = server.index; | 91 index = server.index; |
| 92 createProject(); | 92 createProject(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 Future test_findTopLevelDeclarations() { | 95 // Future test_findTopLevelDeclarations() { |
| 96 // TODO(scheglov) replace this temporary Index test with an actual | 96 // // TODO(scheglov) replace this temporary Index test with an actual |
| 97 // SearchEngine and SearchDomainHandler test. | 97 // // SearchEngine and SearchDomainHandler test. |
| 98 addTestFile(''' | 98 // addTestFile(''' |
| 99 class AAA { | 99 //class AAA { |
| 100 AAA() {} | 100 // AAA() {} |
| 101 //} |
| 102 //'''); |
| 103 // return waitForTasksFinished().then((_) { |
| 104 // return index.getRelationships(UniverseElement.INSTANCE, |
| 105 // IndexConstants.DEFINES_CLASS).then((List<Location> locations) { |
| 106 // bool hasClassFunction = false; |
| 107 // bool hasClassAAA = false; |
| 108 // for (var location in locations) { |
| 109 // if (location.element.name == 'Function') { |
| 110 // hasClassFunction = true; |
| 111 // } |
| 112 // if (location.element.name == 'AAA') { |
| 113 // hasClassAAA = true; |
| 114 // } |
| 115 // } |
| 116 // expect(hasClassFunction, isTrue, reason: locations.toString()); |
| 117 // expect(hasClassAAA, isTrue, reason: locations.toString()); |
| 118 // }); |
| 119 // }); |
| 120 // } |
| 101 } | 121 } |
| 102 '''); | |
| 103 return waitForTasksFinished().then((_) { | |
| 104 return index.getRelationships(UniverseElement.INSTANCE, | |
| 105 IndexConstants.DEFINES_CLASS).then((List<Location> locations) { | |
| 106 bool hasClassFunction = false; | |
| 107 bool hasClassAAA = false; | |
| 108 for (var location in locations) { | |
| 109 if (location.element.name == 'Function') { | |
| 110 hasClassFunction = true; | |
| 111 } | |
| 112 if (location.element.name == 'AAA') { | |
| 113 hasClassAAA = true; | |
| 114 } | |
| 115 } | |
| 116 expect(hasClassFunction, isTrue, reason: locations.toString()); | |
| 117 expect(hasClassAAA, isTrue, reason: locations.toString()); | |
| 118 }); | |
| 119 }); | |
| 120 } | |
| 121 } | |
| OLD | NEW |