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.services.src.search.search_engine; | 5 library test.services.src.search.search_engine; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 addSource('/unitA.dart', codeA); | 345 addSource('/unitA.dart', codeA); |
346 addSource('/unitB.dart', codeB); | 346 addSource('/unitB.dart', codeB); |
347 _indexTestUnit(''' | 347 _indexTestUnit(''' |
348 library lib; | 348 library lib; |
349 part 'unitA.dart'; | 349 part 'unitA.dart'; |
350 part 'unitB.dart'; | 350 part 'unitB.dart'; |
351 '''); | 351 '''); |
352 LibraryElement element = testLibraryElement; | 352 LibraryElement element = testLibraryElement; |
353 CompilationUnitElement elementA = element.parts[0]; | 353 CompilationUnitElement elementA = element.parts[0]; |
354 CompilationUnitElement elementB = element.parts[1]; | 354 CompilationUnitElement elementB = element.parts[1]; |
355 index.indexUnit(context, elementA.node); | 355 index.indexUnit(context, elementA.computeNode()); |
356 index.indexUnit(context, elementB.node); | 356 index.indexUnit(context, elementB.computeNode()); |
357 var expected = [ | 357 var expected = [ |
358 new ExpectedMatch(elementA, MatchKind.REFERENCE, | 358 new ExpectedMatch(elementA, MatchKind.REFERENCE, |
359 codeA.indexOf('lib; // A'), 'lib'.length), | 359 codeA.indexOf('lib; // A'), 'lib'.length), |
360 new ExpectedMatch(elementB, MatchKind.REFERENCE, | 360 new ExpectedMatch(elementB, MatchKind.REFERENCE, |
361 codeB.indexOf('lib; // B'), 'lib'.length), | 361 codeB.indexOf('lib; // B'), 'lib'.length), |
362 ]; | 362 ]; |
363 return _verifyReferences(element, expected); | 363 return _verifyReferences(element, expected); |
364 } | 364 } |
365 | 365 |
366 Future test_searchReferences_LocalVariableElement() { | 366 Future test_searchReferences_LocalVariableElement() { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 .then((List<SearchMatch> matches) { | 639 .then((List<SearchMatch> matches) { |
640 _assertMatches(matches, expectedMatches); | 640 _assertMatches(matches, expectedMatches); |
641 }); | 641 }); |
642 } | 642 } |
643 | 643 |
644 static void _assertMatches( | 644 static void _assertMatches( |
645 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { | 645 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { |
646 expect(matches, unorderedEquals(expectedMatches)); | 646 expect(matches, unorderedEquals(expectedMatches)); |
647 } | 647 } |
648 } | 648 } |
OLD | NEW |