| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |