Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: pkg/analysis_server/test/services/search/search_engine_test.dart

Issue 1371463002: Record HAS_ANCESTOR relations into index. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/test/services/index/dart_index_contributor_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 class SearchEngineImplTest extends AbstractSingleUnitTest { 70 class SearchEngineImplTest extends AbstractSingleUnitTest {
71 Index index; 71 Index index;
72 SearchEngineImpl searchEngine; 72 SearchEngineImpl searchEngine;
73 73
74 void setUp() { 74 void setUp() {
75 super.setUp(); 75 super.setUp();
76 index = createLocalMemoryIndex(); 76 index = createLocalMemoryIndex();
77 searchEngine = new SearchEngineImpl(index); 77 searchEngine = new SearchEngineImpl(index);
78 } 78 }
79 79
80 Future test_searchAllSubtypes() {
81 _indexTestUnit('''
82 class T {}
83 class A extends T {}
84 class B extends A {}
85 class C implements B {}
86 ''');
87 ClassElement element = findElement('T');
88 ClassElement elementA = findElement('A');
89 ClassElement elementB = findElement('B');
90 ClassElement elementC = findElement('C');
91 var expected = [
92 _expectId(elementA, MatchKind.DECLARATION, 'A extends T'),
93 _expectId(elementB, MatchKind.DECLARATION, 'B extends A'),
94 _expectId(elementC, MatchKind.DECLARATION, 'C implements B')
95 ];
96 return searchEngine.searchAllSubtypes(element).then((matches) {
97 _assertMatches(matches, expected);
98 });
99 }
100
80 Future test_searchElementDeclarations() { 101 Future test_searchElementDeclarations() {
81 _indexTestUnit(''' 102 _indexTestUnit('''
82 class A { 103 class A {
83 test() {} 104 test() {}
84 } 105 }
85 class B { 106 class B {
86 int test = 1; 107 int test = 1;
87 main() { 108 main() {
88 int test = 2; 109 int test = 2;
89 } 110 }
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 .then((List<SearchMatch> matches) { 668 .then((List<SearchMatch> matches) {
648 _assertMatches(matches, expectedMatches); 669 _assertMatches(matches, expectedMatches);
649 }); 670 });
650 } 671 }
651 672
652 static void _assertMatches( 673 static void _assertMatches(
653 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) { 674 List<SearchMatch> matches, List<ExpectedMatch> expectedMatches) {
654 expect(matches, unorderedEquals(expectedMatches)); 675 expect(matches, unorderedEquals(expectedMatches));
655 } 676 }
656 } 677 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/index/dart_index_contributor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698