| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 432 } |
| 433 '''); | 433 '''); |
| 434 LabelElement element = findElement('label'); | 434 LabelElement element = findElement('label'); |
| 435 Element mainElement = findElement('main'); | 435 Element mainElement = findElement('main'); |
| 436 var expected = [ | 436 var expected = [ |
| 437 _expectId(mainElement, MatchKind.REFERENCE, 'label; // 1'), | 437 _expectId(mainElement, MatchKind.REFERENCE, 'label; // 1'), |
| 438 _expectId(mainElement, MatchKind.REFERENCE, 'label; // 2')]; | 438 _expectId(mainElement, MatchKind.REFERENCE, 'label; // 2')]; |
| 439 return _verifyReferences(element, expected); | 439 return _verifyReferences(element, expected); |
| 440 } | 440 } |
| 441 | 441 |
| 442 Future test_searchReferences_PrefixElement() { |
| 443 _indexTestUnit(''' |
| 444 import 'dart:async' as ppp; |
| 445 main() { |
| 446 ppp.Future a; |
| 447 ppp.Stream b; |
| 448 } |
| 449 '''); |
| 450 PrefixElement element = findNodeElementAtString('ppp;'); |
| 451 Element elementA = findElement('a'); |
| 452 Element elementB = findElement('b'); |
| 453 var expected = [ |
| 454 _expectId(elementA, MatchKind.REFERENCE, 'ppp.Future'), |
| 455 _expectId(elementB, MatchKind.REFERENCE, 'ppp.Stream')]; |
| 456 return _verifyReferences(element, expected); |
| 457 } |
| 458 |
| 442 Future test_searchReferences_MethodElement() { | 459 Future test_searchReferences_MethodElement() { |
| 443 _indexTestUnit(''' | 460 _indexTestUnit(''' |
| 444 class A { | 461 class A { |
| 445 m() {} | 462 m() {} |
| 446 main() { | 463 main() { |
| 447 m(); // 1 | 464 m(); // 1 |
| 448 this.m(); // 2 | 465 this.m(); // 2 |
| 449 print(m); // 3 | 466 print(m); // 3 |
| 450 print(this.m); // 4 | 467 print(this.m); // 4 |
| 451 } | 468 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 pattern).then((List<SearchMatch> matches) { | 694 pattern).then((List<SearchMatch> matches) { |
| 678 _assertMatches(matches, expectedMatches); | 695 _assertMatches(matches, expectedMatches); |
| 679 }); | 696 }); |
| 680 } | 697 } |
| 681 | 698 |
| 682 static void _assertMatches(List<SearchMatch> matches, | 699 static void _assertMatches(List<SearchMatch> matches, |
| 683 List<ExpectedMatch> expectedMatches) { | 700 List<ExpectedMatch> expectedMatches) { |
| 684 expect(matches, unorderedEquals(expectedMatches)); | 701 expect(matches, unorderedEquals(expectedMatches)); |
| 685 } | 702 } |
| 686 } | 703 } |
| OLD | NEW |