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

Side by Side Diff: pkg/analysis_server/test/analysis/notification_occurrences_test.dart

Issue 668763002: Issue 21238. Fix for NPE in occurrences computer when FieldFormalParameterElement references unreso… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_occurrences.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.analysis.notification.occurrences; 5 library test.analysis.notification.occurrences;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 '''); 129 ''');
130 return prepareOccurrences().then((_) { 130 return prepareOccurrences().then((_) {
131 assertHasRegion('fff;'); 131 assertHasRegion('fff;');
132 expect(testOccurences.element.kind, ElementKind.FIELD); 132 expect(testOccurences.element.kind, ElementKind.FIELD);
133 assertHasOffset('fff); // constructor'); 133 assertHasOffset('fff); // constructor');
134 assertHasOffset('fff = 42;'); 134 assertHasOffset('fff = 42;');
135 assertHasOffset('fff); // print'); 135 assertHasOffset('fff); // print');
136 }); 136 });
137 } 137 }
138 138
139 test_field_unresolved() {
140 addTestFile('''
141 class A {
142 A(this.noSuchField);
143 }
144 ''');
145 // no checks for occurrences, just ensure that there is no NPE
146 return prepareOccurrences();
147 }
148
139 test_localVariable() { 149 test_localVariable() {
140 addTestFile(''' 150 addTestFile('''
141 main() { 151 main() {
142 var vvv = 42; 152 var vvv = 42;
143 vvv += 5; 153 vvv += 5;
144 print(vvv); 154 print(vvv);
145 } 155 }
146 '''); 156 ''');
147 return prepareOccurrences().then((_) { 157 return prepareOccurrences().then((_) {
148 assertHasRegion('vvv ='); 158 assertHasRegion('vvv =');
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 addTestFile(''' 258 addTestFile('''
249 void main() { 259 void main() {
250 } 260 }
251 '''); 261 ''');
252 return prepareOccurrences().then((_) { 262 return prepareOccurrences().then((_) {
253 int offset = findOffset('void main()'); 263 int offset = findOffset('void main()');
254 findRegion(offset, 'void'.length, false); 264 findRegion(offset, 'void'.length, false);
255 }); 265 });
256 } 266 }
257 } 267 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_occurrences.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698