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

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: Created 3 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 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart'; 5 import 'package:analysis_server/src/provisional/completion/dart/completion_dart. dart';
6 import 'package:analysis_server/src/services/completion/dart/arglist_contributor .dart'; 6 import 'package:analysis_server/src/services/completion/dart/arglist_contributor .dart';
7 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 7 import 'package:analyzer_plugin/protocol/protocol_common.dart';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; 9 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 fail_test_Annotation_local_constructor_named_param_9() async { 153 fail_test_Annotation_local_constructor_named_param_9() async {
154 addTestSource(''' 154 addTestSource('''
155 class A { const A({int one, String two: 'defaultValue'}); } 155 class A { const A({int one, String two: 'defaultValue'}); }
156 @A(two: '2'^) main() { }'''); 156 @A(two: '2'^) main() { }''');
157 await computeSuggestions(); 157 await computeSuggestions();
158 assertSuggestions([', one: ']); 158 assertSuggestions([', one: ']);
159 } 159 }
160 160
161 test_Annotation_imported_constructor_named_param() async { 161 test_Annotation_imported_constructor_named_param() async {
162 addSource( 162 addSource('/libA.dart', '''
163 '/libA.dart',
164 '''
165 library libA; class A { const A({int one, String two: 'defaultValue'}); }'''); 163 library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
166 addTestSource('import "/libA.dart"; @A(^) main() { }'); 164 addTestSource('import "/libA.dart"; @A(^) main() { }');
167 await computeSuggestions(); 165 await computeSuggestions();
168 assertSuggestArgumentsAndTypes( 166 assertSuggestArgumentsAndTypes(
169 namedArgumentsWithTypes: {'one': 'int', 'two': 'String'}); 167 namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
170 } 168 }
171 169
172 test_Annotation_local_constructor_named_param() async { 170 test_Annotation_local_constructor_named_param() async {
173 addTestSource(''' 171 addTestSource('''
174 class A { const A({int one, String two: 'defaultValue'}); } 172 class A { const A({int one, String two: 'defaultValue'}); }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 addSource('/libA.dart', 471 addSource('/libA.dart',
474 'library libA; class A {factory A({int i, String s, d}) {} }}'); 472 'library libA; class A {factory A({int i, String s, d}) {} }}');
475 addTestSource('import "/libA.dart"; main() { var a = new A(^);}'); 473 addTestSource('import "/libA.dart"; main() { var a = new A(^);}');
476 await computeSuggestions(); 474 await computeSuggestions();
477 assertSuggestArgumentsAndTypes( 475 assertSuggestArgumentsAndTypes(
478 namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'}); 476 namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
479 } 477 }
480 478
481 test_ArgumentList_imported_function_0() async { 479 test_ArgumentList_imported_function_0() async {
482 // ArgumentList MethodInvocation ExpressionStatement Block 480 // ArgumentList MethodInvocation ExpressionStatement Block
483 addSource( 481 addSource('/libA.dart', '''
484 '/libA.dart',
485 '''
486 library A; 482 library A;
487 bool hasLength(int expected) { } 483 bool hasLength(int expected) { }
488 expect() { } 484 expect() { }
489 void baz() { }'''); 485 void baz() { }''');
490 addTestSource(''' 486 addTestSource('''
491 import '/libA.dart' 487 import '/libA.dart'
492 class B { } 488 class B { }
493 String bar() => true; 489 String bar() => true;
494 void main() {expect(a^)}'''); 490 void main() {expect(a^)}''');
495 await computeSuggestions(); 491 await computeSuggestions();
496 assertNoSuggestions(); 492 assertNoSuggestions();
497 } 493 }
498 494
499 test_ArgumentList_imported_function_1() async { 495 test_ArgumentList_imported_function_1() async {
500 // ArgumentList MethodInvocation ExpressionStatement Block 496 // ArgumentList MethodInvocation ExpressionStatement Block
501 addSource( 497 addSource('/libA.dart', '''
502 '/libA.dart',
503 '''
504 library A; 498 library A;
505 bool hasLength(int expected) { } 499 bool hasLength(int expected) { }
506 expect(String arg) { } 500 expect(String arg) { }
507 void baz() { }'''); 501 void baz() { }''');
508 addTestSource(''' 502 addTestSource('''
509 import '/libA.dart' 503 import '/libA.dart'
510 class B { } 504 class B { }
511 String bar() => true; 505 String bar() => true;
512 void main() {expect(^)}'''); 506 void main() {expect(^)}''');
513 await computeSuggestions(); 507 await computeSuggestions();
514 assertSuggestArgumentList(['arg'], ['String']); 508 assertSuggestArgumentList(['arg'], ['String']);
515 } 509 }
516 510
517 test_ArgumentList_imported_function_2() async { 511 test_ArgumentList_imported_function_2() async {
518 // ArgumentList MethodInvocation ExpressionStatement Block 512 // ArgumentList MethodInvocation ExpressionStatement Block
519 addSource( 513 addSource('/libA.dart', '''
520 '/libA.dart',
521 '''
522 library A; 514 library A;
523 bool hasLength(int expected) { } 515 bool hasLength(int expected) { }
524 expect(String arg1, int arg2) { } 516 expect(String arg1, int arg2) { }
525 void baz() { }'''); 517 void baz() { }''');
526 addTestSource(''' 518 addTestSource('''
527 import '/libA.dart' 519 import '/libA.dart'
528 class B { } 520 class B { }
529 String bar() => true; 521 String bar() => true;
530 void main() {expect(^)}'''); 522 void main() {expect(^)}''');
531 await computeSuggestions(); 523 await computeSuggestions();
532 assertSuggestArgumentList(['arg1', 'arg2'], ['String', 'int']); 524 assertSuggestArgumentList(['arg1', 'arg2'], ['String', 'int']);
533 } 525 }
534 526
535 test_ArgumentList_imported_function_3() async { 527 test_ArgumentList_imported_function_3() async {
536 // ArgumentList MethodInvocation ExpressionStatement Block 528 // ArgumentList MethodInvocation ExpressionStatement Block
537 addSource( 529 addSource('/libA.dart', '''
538 '/libA.dart',
539 '''
540 library A; 530 library A;
541 bool hasLength(int expected) { } 531 bool hasLength(int expected) { }
542 expect(String arg1, int arg2, {bool arg3}) { } 532 expect(String arg1, int arg2, {bool arg3}) { }
543 void baz() { }'''); 533 void baz() { }''');
544 addTestSource(''' 534 addTestSource('''
545 import '/libA.dart' 535 import '/libA.dart'
546 class B { } 536 class B { }
547 String bar() => true; 537 String bar() => true;
548 void main() {expect(^)}'''); 538 void main() {expect(^)}''');
549 await computeSuggestions(); 539 await computeSuggestions();
550 assertSuggestArgumentList(['arg1', 'arg2'], ['String', 'int']); 540 assertSuggestArgumentList(['arg1', 'arg2'], ['String', 'int']);
551 } 541 }
552 542
553 test_ArgumentList_imported_function_3a() async { 543 test_ArgumentList_imported_function_3a() async {
554 // ArgumentList MethodInvocation ExpressionStatement Block 544 // ArgumentList MethodInvocation ExpressionStatement Block
555 addSource( 545 addSource('/libA.dart', '''
556 '/libA.dart',
557 '''
558 library A; 546 library A;
559 bool hasLength(int expected) { } 547 bool hasLength(int expected) { }
560 expect(String arg1, int arg2, {bool arg3}) { } 548 expect(String arg1, int arg2, {bool arg3}) { }
561 void baz() { }'''); 549 void baz() { }''');
562 addTestSource(''' 550 addTestSource('''
563 import '/libA.dart' 551 import '/libA.dart'
564 class B { } 552 class B { }
565 String bar() => true; 553 String bar() => true;
566 void main() {expect('hello', ^)}'''); 554 void main() {expect('hello', ^)}''');
567 await computeSuggestions(); 555 await computeSuggestions();
568 assertNoSuggestions(); 556 assertNoSuggestions();
569 } 557 }
570 558
571 test_ArgumentList_imported_function_3b() async { 559 test_ArgumentList_imported_function_3b() async {
572 // ArgumentList MethodInvocation ExpressionStatement Block 560 // ArgumentList MethodInvocation ExpressionStatement Block
573 addSource( 561 addSource('/libA.dart', '''
574 '/libA.dart',
575 '''
576 library A; 562 library A;
577 bool hasLength(int expected) { } 563 bool hasLength(int expected) { }
578 expect(String arg1, int arg2, {bool arg3}) { } 564 expect(String arg1, int arg2, {bool arg3}) { }
579 void baz() { }'''); 565 void baz() { }''');
580 addTestSource(''' 566 addTestSource('''
581 import '/libA.dart' 567 import '/libA.dart'
582 class B { } 568 class B { }
583 String bar() => true; 569 String bar() => true;
584 void main() {expect('hello', ^x)}'''); 570 void main() {expect('hello', ^x)}''');
585 await computeSuggestions(); 571 await computeSuggestions();
586 assertNoSuggestions(); 572 assertNoSuggestions();
587 } 573 }
588 574
589 test_ArgumentList_imported_function_3c() async { 575 test_ArgumentList_imported_function_3c() async {
590 // ArgumentList MethodInvocation ExpressionStatement Block 576 // ArgumentList MethodInvocation ExpressionStatement Block
591 addSource( 577 addSource('/libA.dart', '''
592 '/libA.dart',
593 '''
594 library A; 578 library A;
595 bool hasLength(int expected) { } 579 bool hasLength(int expected) { }
596 expect(String arg1, int arg2, {bool arg3}) { } 580 expect(String arg1, int arg2, {bool arg3}) { }
597 void baz() { }'''); 581 void baz() { }''');
598 addTestSource(''' 582 addTestSource('''
599 import '/libA.dart' 583 import '/libA.dart'
600 class B { } 584 class B { }
601 String bar() => true; 585 String bar() => true;
602 void main() {expect('hello', x^)}'''); 586 void main() {expect('hello', x^)}''');
603 await computeSuggestions(); 587 await computeSuggestions();
604 assertNoSuggestions(); 588 assertNoSuggestions();
605 } 589 }
606 590
607 test_ArgumentList_imported_function_3d() async { 591 test_ArgumentList_imported_function_3d() async {
608 // ArgumentList MethodInvocation ExpressionStatement Block 592 // ArgumentList MethodInvocation ExpressionStatement Block
609 addSource( 593 addSource('/libA.dart', '''
610 '/libA.dart',
611 '''
612 library A; 594 library A;
613 bool hasLength(int expected) { } 595 bool hasLength(int expected) { }
614 expect(String arg1, int arg2, {bool arg3}) { } 596 expect(String arg1, int arg2, {bool arg3}) { }
615 void baz() { }'''); 597 void baz() { }''');
616 addTestSource(''' 598 addTestSource('''
617 import '/libA.dart' 599 import '/libA.dart'
618 class B { } 600 class B { }
619 String bar() => true; 601 String bar() => true;
620 void main() {expect('hello', x ^)}'''); 602 void main() {expect('hello', x ^)}''');
621 await computeSuggestions(); 603 await computeSuggestions();
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // 980 //
999 addTestSource(''' 981 addTestSource('''
1000 f(v,{int radix, int onError(String s)}){} 982 f(v,{int radix, int onError(String s)}){}
1001 main() { f("16", radix: ^);}'''); 983 main() { f("16", radix: ^);}''');
1002 await computeSuggestions(); 984 await computeSuggestions();
1003 assertNoSuggestions(); 985 assertNoSuggestions();
1004 } 986 }
1005 987
1006 test_ArgumentList_local_method_0() async { 988 test_ArgumentList_local_method_0() async {
1007 // ArgumentList MethodInvocation ExpressionStatement Block 989 // ArgumentList MethodInvocation ExpressionStatement Block
1008 addSource( 990 addSource('/libA.dart', '''
1009 '/libA.dart',
1010 '''
1011 library A; 991 library A;
1012 bool hasLength(int expected) { } 992 bool hasLength(int expected) { }
1013 void baz() { }'''); 993 void baz() { }''');
1014 addTestSource(''' 994 addTestSource('''
1015 import '/libA.dart' 995 import '/libA.dart'
1016 class B { 996 class B {
1017 expect() { } 997 expect() { }
1018 void foo() {expect(^)}} 998 void foo() {expect(^)}}
1019 String bar() => true;'''); 999 String bar() => true;''');
1020 await computeSuggestions(); 1000 await computeSuggestions();
1021 assertNoSuggestions(); 1001 assertNoSuggestions();
1022 } 1002 }
1023 1003
1024 test_ArgumentList_local_method_2() async { 1004 test_ArgumentList_local_method_2() async {
1025 // ArgumentList MethodInvocation ExpressionStatement Block 1005 // ArgumentList MethodInvocation ExpressionStatement Block
1026 addSource( 1006 addSource('/libA.dart', '''
1027 '/libA.dart',
1028 '''
1029 library A; 1007 library A;
1030 bool hasLength(int expected) { } 1008 bool hasLength(int expected) { }
1031 void baz() { }'''); 1009 void baz() { }''');
1032 addTestSource(''' 1010 addTestSource('''
1033 import '/libA.dart' 1011 import '/libA.dart'
1034 class B { 1012 class B {
1035 expect(arg, int blat) { } 1013 expect(arg, int blat) { }
1036 void foo() {expect(^)}} 1014 void foo() {expect(^)}}
1037 String bar() => true;'''); 1015 String bar() => true;''');
1038 await computeSuggestions(); 1016 await computeSuggestions();
1039 assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']); 1017 assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']);
1040 } 1018 }
1041 } 1019 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698