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

Side by Side Diff: pkg/analysis_server/test/search/member_references_test.dart

Issue 1786013004: Start using the new index in Analysis Server. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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.search.member_references; 5 library test.search.member_references;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 print(b.foo); // resolved B 48 print(b.foo); // resolved B
49 } 49 }
50 mainUnresolved(a, b) { 50 mainUnresolved(a, b) {
51 a.foo = 10; 51 a.foo = 10;
52 b.foo = 20; 52 b.foo = 20;
53 print(a.foo); // unresolved A 53 print(a.foo); // unresolved A
54 print(b.foo); // unresolved B 54 print(b.foo); // unresolved B
55 } 55 }
56 '''); 56 ''');
57 await findMemberReferences('foo'); 57 await findMemberReferences('foo');
58 assertHasRef(SearchResultKind.WRITE, 'foo = 1;', false); 58 assertNoResult(SearchResultKind.WRITE, 'foo = 1;');
59 assertHasRef(SearchResultKind.WRITE, 'foo = 2;', false); 59 assertNoResult(SearchResultKind.WRITE, 'foo = 2;');
60 assertHasRef(SearchResultKind.READ, 'foo); // resolved A', false); 60 assertNoResult(SearchResultKind.READ, 'foo); // resolved A');
61 assertHasRef(SearchResultKind.READ, 'foo); // resolved B', false); 61 assertNoResult(SearchResultKind.READ, 'foo); // resolved B');
62 assertHasRef(SearchResultKind.WRITE, 'foo = 10;', true); 62 assertHasRef(SearchResultKind.WRITE, 'foo = 10;', true);
63 assertHasRef(SearchResultKind.WRITE, 'foo = 20;', true); 63 assertHasRef(SearchResultKind.WRITE, 'foo = 20;', true);
64 assertHasRef(SearchResultKind.READ, 'foo); // unresolved A', true); 64 assertHasRef(SearchResultKind.READ, 'foo); // unresolved A', true);
65 assertHasRef(SearchResultKind.READ, 'foo); // unresolved B', true); 65 assertHasRef(SearchResultKind.READ, 'foo); // unresolved B', true);
66 } 66 }
67 67
68 test_fields_implicit() async { 68 test_fields_implicit() async {
69 addTestFile(''' 69 addTestFile('''
70 class A { 70 class A {
71 get foo => null; 71 get foo => null;
72 } 72 }
73 class B { 73 class B {
74 get foo => null; 74 get foo => null;
75 } 75 }
76 mainResolved(A a, B b) { 76 mainResolved(A a, B b) {
77 print(a.foo); // resolved A 77 print(a.foo); // resolved A
78 print(b.foo); // resolved B 78 print(b.foo); // resolved B
79 } 79 }
80 mainUnresolved(a, b) { 80 mainUnresolved(a, b) {
81 print(a.foo); // unresolved A 81 print(a.foo); // unresolved A
82 print(b.foo); // unresolved B 82 print(b.foo); // unresolved B
83 } 83 }
84 '''); 84 ''');
85 await findMemberReferences('foo'); 85 await findMemberReferences('foo');
86 assertHasRef(SearchResultKind.READ, 'foo); // resolved A', false); 86 assertNoResult(SearchResultKind.READ, 'foo); // resolved A');
87 assertHasRef(SearchResultKind.READ, 'foo); // resolved B', false); 87 assertNoResult(SearchResultKind.READ, 'foo); // resolved B');
88 assertHasRef(SearchResultKind.READ, 'foo); // unresolved A', true); 88 assertHasRef(SearchResultKind.READ, 'foo); // unresolved A', true);
89 assertHasRef(SearchResultKind.READ, 'foo); // unresolved B', true); 89 assertHasRef(SearchResultKind.READ, 'foo); // unresolved B', true);
90 } 90 }
91 91
92 test_methods() async { 92 test_methods() async {
93 addTestFile(''' 93 addTestFile('''
94 class A { 94 class A {
95 foo() {} 95 foo() {}
96 } 96 }
97 class B { 97 class B {
98 foo() {} 98 foo() {}
99 } 99 }
100 mainResolved(A a, B b) { 100 mainResolved(A a, B b) {
101 a.foo(1); 101 a.foo(1);
102 b.foo(2); 102 b.foo(2);
103 } 103 }
104 mainUnresolved(a, b) { 104 mainUnresolved(a, b) {
105 a.foo(10); 105 a.foo(10);
106 b.foo(20); 106 b.foo(20);
107 } 107 }
108 '''); 108 ''');
109 await findMemberReferences('foo'); 109 await findMemberReferences('foo');
110 assertHasRef(SearchResultKind.INVOCATION, 'foo(1)', false); 110 assertNoResult(SearchResultKind.INVOCATION, 'foo(1)');
111 assertHasRef(SearchResultKind.INVOCATION, 'foo(2)', false); 111 assertNoResult(SearchResultKind.INVOCATION, 'foo(2)');
112 assertHasRef(SearchResultKind.INVOCATION, 'foo(10)', true); 112 assertHasRef(SearchResultKind.INVOCATION, 'foo(10)', true);
113 assertHasRef(SearchResultKind.INVOCATION, 'foo(20)', true); 113 assertHasRef(SearchResultKind.INVOCATION, 'foo(20)', true);
114 } 114 }
115 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698