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

Unified Diff: pkg/analysis_server/test/search/element_references_test.dart

Issue 567243002: Issue 19696. Test for potential reference to the element defined in a subclass. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/search/element_references_test.dart
diff --git a/pkg/analysis_server/test/search/element_references_test.dart b/pkg/analysis_server/test/search/element_references_test.dart
index 07ae6ca7922b8b4cc9b0e7db6e29d94bd778e2db..8bf11a95641b5696ecb27641f563b99c0a6ad303 100644
--- a/pkg/analysis_server/test/search/element_references_test.dart
+++ b/pkg/analysis_server/test/search/element_references_test.dart
@@ -7,9 +7,9 @@ library test.search.element_references;
import 'dart:async';
import 'package:analysis_server/src/protocol.dart';
-import '../reflective_tests.dart';
import 'package:unittest/unittest.dart';
+import '../reflective_tests.dart';
import 'abstract_search_domain.dart';
@@ -23,6 +23,11 @@ main() {
class ElementReferencesTest extends AbstractSearchDomainTest {
Element searchElement;
+ void assertHasRef(SearchResultKind kind, String search, bool isPotential) {
+ assertHasResult(kind, search);
+ expect(result.isPotential, isPotential);
+ }
+
Future findElementReferences(String search, bool includePotential) {
int offset = findOffset(search);
return waitForTasksFinished().then((_) {
@@ -566,6 +571,30 @@ main(A a, p) {
});
}
+ test_potential_method_definedInSubclass() {
+ addTestFile('''
+class Base {
+ methodInBase() {
+ test(1);
+ }
+}
+class Derived extends Base {
+ test(_) {} // of Derived
+ methodInDerived() {
+ test(2);
+ }
+}
+globalFunction(Base b) {
+ b.test(3);
+}
+''');
+ return findElementReferences('test(_) {} // of Derived', true).then((_) {
+ assertHasRef(SearchResultKind.INVOCATION, 'test(1);', true);
+ assertHasRef(SearchResultKind.INVOCATION, 'test(2);', false);
+ assertHasRef(SearchResultKind.INVOCATION, 'test(3);', true);
+ });
+ }
+
test_topLevelVariable_explicit() {
addTestFile('''
var vvv = 1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698