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

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

Issue 402433003: Search only for potential name references to Class members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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.element_references; 5 library test.search.element_references;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/computer/element.dart'; 9 import 'package:analysis_server/src/computer/element.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 '''); 447 ''');
448 return findElementReferences('test(p) {}', false).then((_) { 448 return findElementReferences('test(p) {}', false).then((_) {
449 assertHasResult(SearchResultKind.INVOCATION, 'test(1);'); 449 assertHasResult(SearchResultKind.INVOCATION, 'test(1);');
450 assertNoResult(SearchResultKind.INVOCATION, 'test(2);'); 450 assertNoResult(SearchResultKind.INVOCATION, 'test(2);');
451 }); 451 });
452 } 452 }
453 453
454 test_potential_field() { 454 test_potential_field() {
455 addTestFile(''' 455 addTestFile('''
456 class A { 456 class A {
457 test; // declaration 457 var test; // declaration
458 } 458 }
459 main(A a, p) { 459 main(A a, p) {
460 a.test = 1; 460 a.test = 1;
461 p.test = 2; 461 p.test = 2;
462 print(p.test); // p 462 print(p.test); // p
463 } 463 }
464 '''); 464 ''');
465 return findElementReferences('test; // declaration', true).then((_) { 465 return findElementReferences('test; // declaration', true).then((_) {
466 { 466 {
467 assertHasResult(SearchResultKind.WRITE, 'test = 1;'); 467 assertHasResult(SearchResultKind.WRITE, 'test = 1;');
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 579 }
580 '''); 580 ''');
581 return findElementReferences('T> {', false).then((_) { 581 return findElementReferences('T> {', false).then((_) {
582 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); 582 expect(searchElement.kind, ElementKind.TYPE_PARAMETER);
583 expect(results, hasLength(2)); 583 expect(results, hasLength(2));
584 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); 584 assertHasResult(SearchResultKind.REFERENCE, 'T f;');
585 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); 585 assertHasResult(SearchResultKind.REFERENCE, 'T m()');
586 }); 586 });
587 } 587 }
588 } 588 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698