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

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

Issue 1246833002: Tweak for navigation for URIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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.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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 assertHasRegionString('part of lib'); 499 assertHasRegionString('part of lib');
500 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); 500 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length);
501 }); 501 });
502 } 502 }
503 503
504 test_string_export() { 504 test_string_export() {
505 var libCode = 'library lib;'; 505 var libCode = 'library lib;';
506 var libFile = addFile('$projectPath/bin/lib.dart', libCode); 506 var libFile = addFile('$projectPath/bin/lib.dart', libCode);
507 addTestFile('export "lib.dart";'); 507 addTestFile('export "lib.dart";');
508 return prepareNavigation().then((_) { 508 return prepareNavigation().then((_) {
509 assertHasRegionString('export "lib.dart"'); 509 assertHasRegionString('"lib.dart"');
510 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); 510 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length);
511 }); 511 });
512 } 512 }
513 513
514 test_string_export_unresolvedUri() { 514 test_string_export_unresolvedUri() {
515 addTestFile('export "no.dart";'); 515 addTestFile('export "no.dart";');
516 return prepareNavigation().then((_) { 516 return prepareNavigation().then((_) {
517 assertNoRegionString('export "no.dart"'); 517 assertNoRegionString('"no.dart"');
518 }); 518 });
519 } 519 }
520 520
521 test_string_import() { 521 test_string_import() {
522 var libCode = 'library lib;'; 522 var libCode = 'library lib;';
523 var libFile = addFile('$projectPath/bin/lib.dart', libCode); 523 var libFile = addFile('$projectPath/bin/lib.dart', libCode);
524 addTestFile('import "lib.dart";'); 524 addTestFile('import "lib.dart";');
525 return prepareNavigation().then((_) { 525 return prepareNavigation().then((_) {
526 assertHasRegionString('import "lib.dart"'); 526 assertHasRegionString('"lib.dart"');
527 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length); 527 assertHasFileTarget(libFile, libCode.indexOf('lib;'), 'lib'.length);
528 }); 528 });
529 } 529 }
530 530
531 test_string_import_noUri() { 531 test_string_import_noUri() {
532 addTestFile('import ;'); 532 addTestFile('import ;');
533 return prepareNavigation().then((_) { 533 return prepareNavigation().then((_) {
534 assertNoRegionAt('import ;'); 534 assertNoRegionAt('import ;');
535 }); 535 });
536 } 536 }
537 537
538 test_string_import_unresolvedUri() { 538 test_string_import_unresolvedUri() {
539 addTestFile('import "no.dart";'); 539 addTestFile('import "no.dart";');
540 return prepareNavigation().then((_) { 540 return prepareNavigation().then((_) {
541 assertNoRegionString('import "no.dart"'); 541 assertNoRegionString('"no.dart"');
542 }); 542 });
543 } 543 }
544 544
545 test_string_part() { 545 test_string_part() {
546 var unitCode = 'part of lib; f() {}'; 546 var unitCode = 'part of lib; f() {}';
547 var unitFile = addFile('$projectPath/bin/test_unit.dart', unitCode); 547 var unitFile = addFile('$projectPath/bin/test_unit.dart', unitCode);
548 addTestFile(''' 548 addTestFile('''
549 library lib; 549 library lib;
550 part "test_unit.dart"; 550 part "test_unit.dart";
551 '''); 551 ''');
552 return prepareNavigation().then((_) { 552 return prepareNavigation().then((_) {
553 assertHasRegionString('part "test_unit.dart"'); 553 assertHasRegionString('"test_unit.dart"');
554 assertHasFileTarget(unitFile, 0, 0); 554 assertHasFileTarget(unitFile, 0, 0);
555 }); 555 });
556 } 556 }
557 557
558 test_string_part_unresolvedUri() { 558 test_string_part_unresolvedUri() {
559 addTestFile(''' 559 addTestFile('''
560 library lib; 560 library lib;
561 part "test_unit.dart"; 561 part "test_unit.dart";
562 '''); 562 ''');
563 return prepareNavigation().then((_) { 563 return prepareNavigation().then((_) {
564 assertNoRegionString('part "test_unit.dart"'); 564 assertNoRegionString('"test_unit.dart"');
565 }); 565 });
566 } 566 }
567 567
568 test_superConstructorInvocation() { 568 test_superConstructorInvocation() {
569 addTestFile(''' 569 addTestFile('''
570 class A { 570 class A {
571 A() {} 571 A() {}
572 A.named() {} 572 A.named() {}
573 } 573 }
574 class B extends A { 574 class B extends A {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 testTargetIndexes = region.targets; 780 testTargetIndexes = region.targets;
781 return; 781 return;
782 } 782 }
783 } 783 }
784 if (exists == true) { 784 if (exists == true) {
785 fail('Expected to find (offset=$offset; length=$length) in\n' 785 fail('Expected to find (offset=$offset; length=$length) in\n'
786 '${regions.join('\n')}'); 786 '${regions.join('\n')}');
787 } 787 }
788 } 788 }
789 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698