Chromium Code Reviews| 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.navigation; | 5 library test.analysis.notification.navigation; |
| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 304 } | 304 } |
| 305 import 'dart:math'; | 305 import 'dart:math'; |
| 306 '''); | 306 '''); |
| 307 return prepareNavigation().then((_) { | 307 return prepareNavigation().then((_) { |
| 308 assertHasRegionTarget('aaa);', 'aaa = 42'); | 308 assertHasRegionTarget('aaa);', 'aaa = 42'); |
| 309 }); | 309 }); |
| 310 } | 310 } |
| 311 | 311 |
| 312 test_instanceCreation_implicit() { | 312 test_instanceCreation_implicit() { |
| 313 addTestFile(''' | 313 addTestFile(''' |
| 314 class A { | 314 class A {} |
| 315 class B<T> { | |
|
Paul Berry
2014/11/03 20:35:13
Rather than modifying these tests to use generic a
scheglov
2014/11/03 20:45:36
Yes, I was not sure if it worth to keep non-generi
| |
| 315 } | 316 } |
| 316 main() { | 317 main() { |
| 317 new A(); | 318 new B<A>(); |
| 318 } | 319 } |
| 319 '''); | 320 '''); |
| 320 return prepareNavigation().then((_) { | 321 return prepareNavigation().then((_) { |
| 321 findRegion(findOffset('new A'), 'new A'.length, true); | 322 { |
| 322 assertHasTarget('A {'); | 323 findRegion(findOffset('new B'), 'new'.length, true); |
| 324 assertHasTarget('B<T> {'); | |
| 325 } | |
| 326 { | |
| 327 findRegion(findOffset('A>();'), 'A'.length, true); | |
| 328 assertHasTarget('A {'); | |
| 329 } | |
| 323 }); | 330 }); |
| 324 } | 331 } |
| 325 | 332 |
| 326 test_instanceCreation_named() { | 333 test_instanceCreation_named() { |
| 327 addTestFile(''' | 334 addTestFile(''' |
| 328 class A { | 335 class A {} |
| 336 class B<T> { | |
| 329 A.named() {} | 337 A.named() {} |
| 330 } | 338 } |
| 331 main() { | 339 main() { |
| 332 new A.named(); | 340 new B<A>.named(); |
| 333 } | 341 } |
| 334 '''); | 342 '''); |
| 335 return prepareNavigation().then((_) { | 343 return prepareNavigation().then((_) { |
| 336 { | 344 { |
| 337 findRegion(findOffset('new '), 'new'.length, true); | 345 findRegion(findOffset('new '), 'new'.length, true); |
| 338 assertHasTarget('named() {}'); | 346 assertHasTarget('named() {}'); |
| 339 } | 347 } |
| 340 { | 348 { |
| 341 findRegion(findOffset('A.named();'), 'A'.length, true); | 349 findRegion(findOffset('B<A>.named();'), 'B'.length, true); |
| 342 assertHasTarget('A {'); | 350 assertHasTarget('B<T> {'); |
| 343 } | 351 } |
| 344 { | 352 { |
| 345 findRegion(findOffset('.named();'), '.named'.length, true); | 353 findRegion(findOffset('.named();'), '.named'.length, true); |
| 346 assertHasTarget('named() {}'); | 354 assertHasTarget('named() {}'); |
| 347 } | 355 } |
| 356 { | |
| 357 findRegion(findOffset('A>.named();'), 'A'.length, true); | |
| 358 assertHasTarget('A {'); | |
| 359 } | |
| 348 }); | 360 }); |
| 349 } | 361 } |
| 350 | 362 |
| 351 test_instanceCreation_unnamed() { | 363 test_instanceCreation_unnamed() { |
| 352 addTestFile(''' | 364 addTestFile(''' |
| 353 class A { | 365 class A {} |
| 354 A() {} | 366 class B<T> { |
| 367 B() {} | |
| 355 } | 368 } |
| 356 main() { | 369 main() { |
| 357 new A(); | 370 new B<A>(); |
| 358 } | 371 } |
| 359 '''); | 372 '''); |
| 360 return prepareNavigation().then((_) { | 373 return prepareNavigation().then((_) { |
| 361 { | 374 { |
| 362 findRegion(findOffset('new '), 'new'.length, true); | 375 findRegion(findOffset('new '), 'new'.length, true); |
| 363 assertHasTarget('A() {}', 0); | 376 assertHasTarget('B() {}', 0); |
| 364 } | 377 } |
| 365 { | 378 { |
| 366 findRegion(findOffset('A();'), 'A'.length, true); | 379 findRegion(findOffset('B<A>();'), 'B'.length, true); |
| 380 assertHasTarget('B<T> {'); | |
| 381 } | |
| 382 { | |
| 383 findRegion(findOffset('A>();'), 'A'.length, true); | |
| 367 assertHasTarget('A {'); | 384 assertHasTarget('A {'); |
| 368 } | 385 } |
| 369 }); | 386 }); |
| 370 } | 387 } |
| 371 | 388 |
| 372 test_multiplyDefinedElement() { | 389 test_multiplyDefinedElement() { |
| 373 addFile('$projectPath/bin/libA.dart', 'library A; int TEST = 1;'); | 390 addFile('$projectPath/bin/libA.dart', 'library A; int TEST = 1;'); |
| 374 addFile('$projectPath/bin/libB.dart', 'library B; int TEST = 2;'); | 391 addFile('$projectPath/bin/libB.dart', 'library B; int TEST = 2;'); |
| 375 addTestFile(''' | 392 addTestFile(''' |
| 376 import 'libA.dart'; | 393 import 'libA.dart'; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 test_type_void() { | 569 test_type_void() { |
| 553 addTestFile(''' | 570 addTestFile(''' |
| 554 void main() { | 571 void main() { |
| 555 } | 572 } |
| 556 '''); | 573 '''); |
| 557 return prepareNavigation().then((_) { | 574 return prepareNavigation().then((_) { |
| 558 assertNoRegionAt('void'); | 575 assertNoRegionAt('void'); |
| 559 }); | 576 }); |
| 560 } | 577 } |
| 561 } | 578 } |
| OLD | NEW |