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

Side by Side Diff: pkg/analysis_server/test/completion_test.dart

Issue 798173004: Add filtering to completion tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « no previous file | pkg/analysis_server/test/completion_test_support.dart » ('j') | 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.completion.support; 5 library test.completion.support;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'completion_test_support.dart'; 9 import 'completion_test_support.dart';
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // space, char, eol are important 71 // space, char, eol are important
72 CompletionTestCase.buildTests('testCommentSnippets011', ''' 72 CompletionTestCase.buildTests('testCommentSnippets011', '''
73 class x implements M!1{}''', <String>["1+Map"]); 73 class x implements M!1{}''', <String>["1+Map"]);
74 74
75 // space, char, eol are important 75 // space, char, eol are important
76 CompletionTestCase.buildTests('testCommentSnippets012', ''' 76 CompletionTestCase.buildTests('testCommentSnippets012', '''
77 class x implements M!1\n{}''', <String>["1+Map"]); 77 class x implements M!1\n{}''', <String>["1+Map"]);
78 78
79 CompletionTestCase.buildTests('testCommentSnippets013', ''' 79 CompletionTestCase.buildTests('testCommentSnippets013', '''
80 class x !2{!1}!3''', 80 class x !2{!1}!3''', <String>["1+num", "2-num", "3-num"], failingTests: '3');
81 <String>["1+num", "2-num", "3-num"]);
82 81
83 // trailing space is important 82 // trailing space is important
84 CompletionTestCase.buildTests('testCommentSnippets014', ''' 83 CompletionTestCase.buildTests('testCommentSnippets014', '''
85 typedef n!1 ;''', <String>["1+num"]); 84 typedef n!1 ;''', <String>["1+num"]);
86 85
87 CompletionTestCase.buildTests('testCommentSnippets015', ''' 86 CompletionTestCase.buildTests('testCommentSnippets015', '''
88 class D {f(){} g(){f!1(f!2);}}''', <String>["1+f", "2+f"]); 87 class D {f(){} g(){f!1(f!2);}}''', <String>["1+f", "2+f"]);
89 88
90 CompletionTestCase.buildTests('testCommentSnippets016', ''' 89 CompletionTestCase.buildTests('testCommentSnippets016', '''
91 class F {m() { m(); !1}}''', <String>["1+m"]); 90 class F {m() { m(); !1}}''', <String>["1+m"]);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 CompletionTestCase.buildTests('testCommentSnippets040', ''' 196 CompletionTestCase.buildTests('testCommentSnippets040', '''
198 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''', 197 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''',
199 <String>["1+add"]); 198 <String>["1+add"]);
200 199
201 CompletionTestCase.buildTests('testCommentSnippets041', ''' 200 CompletionTestCase.buildTests('testCommentSnippets041', '''
202 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''', 201 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''',
203 <String>["1+add"]); 202 <String>["1+add"]);
204 203
205 CompletionTestCase.buildTests('testCommentSnippets042', ''' 204 CompletionTestCase.buildTests('testCommentSnippets042', '''
206 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime. now();d.!1WED!2;}''', 205 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime. now();d.!1WED!2;}''',
207 <String>["1+day", "2-WED"]); 206 <String>["1+day", "2-WED"],
207 failingTests: '2');
208 208
209 CompletionTestCase.buildTests('testCommentSnippets043', ''' 209 CompletionTestCase.buildTests('testCommentSnippets043', '''
210 class L{var k;void.!1}''', <String>["1-k"]); 210 class L{var k;void.!1}''', <String>["1-k"]);
211 211
212 CompletionTestCase.buildTests('testCommentSnippets044', ''' 212 CompletionTestCase.buildTests('testCommentSnippets044', '''
213 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', 213 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''',
214 <String>["1+List", "1+XXX.fisk"], 214 <String>["1+List", "1+XXX.fisk"],
215 failingTests: '1'); 215 failingTests: '1');
216 216
217 CompletionTestCase.buildTests('testCommentSnippets047', ''' 217 CompletionTestCase.buildTests('testCommentSnippets047', '''
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 "1+xdr", 253 "1+xdr",
254 "1+xa", 254 "1+xa",
255 "1+xdr.a", 255 "1+xdr.a",
256 "1+xdr.b", 256 "1+xdr.b",
257 "2-xa", 257 "2-xa",
258 "2-xdr", 258 "2-xdr",
259 "2+xdr.a", 259 "2+xdr.a",
260 "2-xdr.b", 260 "2-xdr.b",
261 "3-b", 261 "3-b",
262 "3+a"], 262 "3+a"],
263 failingTests: '12'); 263 failingTests: '123');
264 264
265 // Type propagation. 265 // Type propagation.
266 CompletionTestCase.buildTests('testCommentSnippets051', ''' 266 CompletionTestCase.buildTests('testCommentSnippets051', '''
267 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 267 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
268 void r() { 268 void r() {
269 var v; 269 var v;
270 if (v is String) { 270 if (v is String) {
271 v.!1length; 271 v.!1length;
272 v.!2getKeys; 272 v.!2getKeys;
273 } 273 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 "1+FileMode._internal1", 612 "1+FileMode._internal1",
613 "1+FileMode._internal"], 613 "1+FileMode._internal"],
614 failingTests: '1'); 614 failingTests: '1');
615 615
616 CompletionTestCase.buildTests('testCommentSnippets078', ''' 616 CompletionTestCase.buildTests('testCommentSnippets078', '''
617 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''', 617 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''',
618 <String>["1+from", "1-clear"]); // static method, instance method 618 <String>["1+from", "1-clear"]); // static method, instance method
619 619
620 CompletionTestCase.buildTests('testCommentSnippets079', ''' 620 CompletionTestCase.buildTests('testCommentSnippets079', '''
621 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''', 621 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''',
622 <String>["1-from", "1+clear"]); // static method, instance method 622 <String>["1-from", "1+clear"],
623 failingTests: '1'); // static method, instance method
623 624
624 CompletionTestCase.buildTests('testCommentSnippets080', ''' 625 CompletionTestCase.buildTests('testCommentSnippets080', '''
625 class RuntimeError{var message;}void main() { RuntimeError.!1 }''', 626 class RuntimeError{var message;}void main() { RuntimeError.!1 }''',
626 <String>["1-message"]); // field 627 <String>["1-message"]); // field
627 628
628 CompletionTestCase.buildTests('testCommentSnippets081', ''' 629 CompletionTestCase.buildTests('testCommentSnippets081', '''
629 class Foo {this.!1}''', <String>["1-Object"]); 630 class Foo {this.!1}''', <String>["1-Object"], failingTests: '1');
630 631
631 CompletionTestCase.buildTests('testCommentSnippets082', ''' 632 CompletionTestCase.buildTests('testCommentSnippets082', '''
632 class HttpRequest {} 633 class HttpRequest {}
633 class HttpResponse {} 634 class HttpResponse {}
634 main() { 635 main() {
635 var v = (HttpRequest req, HttpResp!1) 636 var v = (HttpRequest req, HttpResp!1)
636 }''', <String>["1+HttpResponse"]); 637 }''', <String>["1+HttpResponse"]);
637 638
638 CompletionTestCase.buildTests('testCommentSnippets083', ''' 639 CompletionTestCase.buildTests('testCommentSnippets083', '''
639 main() {(.!1)}''', <String>["1-toString"]); 640 main() {(.!1)}''', <String>["1-toString"], failingTests: '1');
640 641
641 CompletionTestCase.buildTests('testCommentSnippets083a', ''' 642 CompletionTestCase.buildTests('testCommentSnippets083a', '''
642 main() { .!1 }''', <String>["1-toString"]); 643 main() { .!1 }''', <String>["1-toString"], failingTests: '1');
643 644
644 CompletionTestCase.buildTests('testCommentSnippets083b', ''' 645 CompletionTestCase.buildTests('testCommentSnippets083b', '''
645 main() { null.!1 }''', <String>["1+toString"], failingTests: '1'); 646 main() { null.!1 }''', <String>["1+toString"], failingTests: '1');
646 647
647 CompletionTestCase.buildTests('testCommentSnippets084', ''' 648 CompletionTestCase.buildTests('testCommentSnippets084', '''
648 class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''', 649 class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''',
649 <String>["1+Map", "2+List", "2-Map", "3+List", "4+Map", "4-List"], 650 <String>["1+Map", "2+List", "2-Map", "3+List", "4+Map", "4-List"],
650 failingTests: '1234'); 651 failingTests: '1234');
651 652
652 CompletionTestCase.buildTests('testCommentSnippets085', ''' 653 CompletionTestCase.buildTests('testCommentSnippets085', '''
653 class List{}class Map{}class Z extends List with !1Ma!2p {}''', 654 class List{}class Map{}class Z extends List with !1Ma!2p {}''',
654 <String>["1+List", "1+Map", "2+Map", "2-List"], 655 <String>["1+List", "1+Map", "2+Map", "2-List"],
655 failingTests: '12'); 656 failingTests: '12');
656 657
657 CompletionTestCase.buildTests('testCommentSnippets086', ''' 658 CompletionTestCase.buildTests('testCommentSnippets086', '''
658 class Q{f(){xy() {!2};x!1y();}}''', <String>["1+xy", "2+f", "2-xy"]); 659 class Q{f(){xy() {!2};x!1y();}}''',
660 <String>["1+xy", "2+f", "2-xy"],
661 failingTests: '2');
659 662
660 CompletionTestCase.buildTests('testCommentSnippets087', ''' 663 CompletionTestCase.buildTests('testCommentSnippets087', '''
661 class Map{}class Q extends Object with !1Map {}''', 664 class Map{}class Q extends Object with !1Map {}''',
662 <String>["1+Map", "1-HashMap"], 665 <String>["1+Map", "1-HashMap"],
663 failingTests: '1'); 666 failingTests: '1');
664 667
665 CompletionTestCase.buildTests('testCommentSnippets088', ''' 668 CompletionTestCase.buildTests('testCommentSnippets088', '''
666 class A { 669 class A {
667 int f; 670 int f;
668 B m(){} 671 B m(){}
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 "4+fqi", 721 "4+fqi",
719 "4+Q", 722 "4+Q",
720 "4+xya", 723 "4+xya",
721 "4-xyb", 724 "4-xyb",
722 "4+xza", 725 "4+xza",
723 "5+fqe", 726 "5+fqe",
724 "5+fqi", 727 "5+fqi",
725 "5+Q", 728 "5+Q",
726 "5-xya", 729 "5-xya",
727 "5-xyb", 730 "5-xyb",
728 "5-xza"]); 731 "5-xza"],
732 failingTests: '123');
729 733
730 CompletionTestCase.buildTests('testCommentSnippets090', ''' 734 CompletionTestCase.buildTests('testCommentSnippets090', '''
731 class X { f() { var a = 'x'; a.!1 }}''', 735 class X { f() { var a = 'x'; a.!1 }}''',
732 <String>["1+length"], 736 <String>["1+length"],
733 failingTests: '1'); 737 failingTests: '1');
734 } 738 }
735 739
736 void buildCompletionTests() { 740 void buildCompletionTests() {
737 CompletionTestCase.buildTests('testCompletion_alias_field', ''' 741 CompletionTestCase.buildTests('testCompletion_alias_field', '''
738 typedef int fnint(int k); fn!1int x;''', <String>["1+fnint"]); 742 typedef int fnint(int k); fn!1int x;''', <String>["1+fnint"]);
739 743
740 CompletionTestCase.buildTests('testCompletion_annotation_argumentList', ''' 744 CompletionTestCase.buildTests('testCompletion_annotation_argumentList', '''
741 class AAA {", 745 class AAA {",
742 const AAA({int aaa, int bbb});", 746 const AAA({int aaa, int bbb});",
743 }", 747 }",
744 ", 748 ",
745 @AAA(!1) 749 @AAA(!1)
746 main() { 750 main() {
747 }''', 751 }''',
748 <String>["1+AAA" /*":" + ProposalKind.ARGUMENT_LIST*/, "1+aaa", "1+bbb"] , 752 <String>["1+AAA" /*":" + ProposalKind.ARGUMENT_LIST*/, "1+aaa", "1+bbb"] ,
749 failingTests: '1'); 753 failingTests: '1');
750 754
751 CompletionTestCase.buildTests('testCompletion_annotation_topLevelVar', ''' 755 CompletionTestCase.buildTests('testCompletion_annotation_topLevelVar', '''
752 const fooConst = null; 756 const fooConst = null;
753 final fooNotConst = null; 757 final fooNotConst = null;
754 const bar = null; 758 const bar = null;
755 759
756 @foo!1 760 @foo!1
757 main() { 761 main() {
758 }''', <String>["1+fooConst", "1-fooNotConst", "1-bar"]); 762 }''', <String>["1+fooConst", "1-fooNotConst", "1-bar"], failingTests: '1');
759 763
760 CompletionTestCase.buildTests('testCompletion_annotation_type', ''' 764 CompletionTestCase.buildTests('testCompletion_annotation_type', '''
761 class AAA { 765 class AAA {
762 const AAA({int a, int b}); 766 const AAA({int a, int b});
763 const AAA.nnn(int c, int d); 767 const AAA.nnn(int c, int d);
764 } 768 }
765 @AAA!1 769 @AAA!1
766 main() { 770 main() {
767 }''', 771 }''',
768 <String>[ 772 <String>[
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 817
814 main(A p) { 818 main(A p) {
815 var v = p.as!1; 819 var v = p.as!1;
816 }''', <String>["1+asVisible"]); 820 }''', <String>["1+asVisible"]);
817 821
818 CompletionTestCase.buildTests('testCompletion_as_incompleteStatement', ''' 822 CompletionTestCase.buildTests('testCompletion_as_incompleteStatement', '''
819 class MyClass {} 823 class MyClass {}
820 main(p) { 824 main(p) {
821 var justSomeVar; 825 var justSomeVar;
822 var v = p as !1 826 var v = p as !1
823 }''', <String>["1+MyClass", "1-justSomeVar"]); 827 }''', <String>["1+MyClass", "1-justSomeVar"], failingTests: '1');
824 828
825 CompletionTestCase.buildTests('testCompletion_cascade', ''' 829 CompletionTestCase.buildTests('testCompletion_cascade', '''
826 class A { 830 class A {
827 aaa() {} 831 aaa() {}
828 } 832 }
829 833
830 834
831 main(A a) { 835 main(A a) {
832 a..!1 aaa(); 836 a..!1 aaa();
833 }''', <String>["1+aaa", "1-main"]); 837 }''', <String>["1+aaa", "1-main"]);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 class B {} 992 class B {}
989 /** 993 /**
990 * [!3] some text 994 * [!3] some text
991 */ 995 */
992 class C {}''', 996 class C {}''',
993 <String>["1+double", "1-int", "2+int", "2+String", "3+int", "3+String"]) ; 997 <String>["1+double", "1-int", "2+int", "2+String", "3+int", "3+String"]) ;
994 998
995 CompletionTestCase.buildTests('testCompletion_double_inFractionPart', ''' 999 CompletionTestCase.buildTests('testCompletion_double_inFractionPart', '''
996 main() { 1000 main() {
997 1.0!1 1001 1.0!1
998 }''', <String>["1-abs", "1-main"]); 1002 }''', <String>["1-abs", "1-main"], failingTests: '1');
999 1003
1000 CompletionTestCase.buildTests('testCompletion_enum', ''' 1004 CompletionTestCase.buildTests('testCompletion_enum', '''
1001 enum MyEnum {A, B, C} 1005 enum MyEnum {A, B, C}
1002 main() { 1006 main() {
1003 MyEnum.!1; 1007 MyEnum.!1;
1004 }''', <String>["1+values", "1+A", "1+B", "1+C"], failingTests: '1'); 1008 }''', <String>["1+values", "1+A", "1+B", "1+C"], failingTests: '1');
1005 1009
1006 CompletionTestCase.buildTests( 1010 CompletionTestCase.buildTests(
1007 'testCompletion_exactPrefix_hasHigherRelevance', 1011 'testCompletion_exactPrefix_hasHigherRelevance',
1008 ''' 1012 '''
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 main(A p) { 1228 main(A p) {
1225 var v1 = p.is!1; 1229 var v1 = p.is!1;
1226 var v2 = p.is!2 1230 var v2 = p.is!2
1227 }''', <String>["1+isVisible", "2+isVisible"]); 1231 }''', <String>["1+isVisible", "2+isVisible"]);
1228 1232
1229 CompletionTestCase.buildTests('testCompletion_is_incompleteStatement1', ''' 1233 CompletionTestCase.buildTests('testCompletion_is_incompleteStatement1', '''
1230 class MyClass {} 1234 class MyClass {}
1231 main(p) { 1235 main(p) {
1232 var justSomeVar; 1236 var justSomeVar;
1233 var v = p is !1 1237 var v = p is !1
1234 }''', <String>["1+MyClass", "1-justSomeVar"]); 1238 }''', <String>["1+MyClass", "1-justSomeVar"], failingTests: '1');
1235 1239
1236 CompletionTestCase.buildTests('testCompletion_is_incompleteStatement2', ''' 1240 CompletionTestCase.buildTests('testCompletion_is_incompleteStatement2', '''
1237 class MyClass {} 1241 class MyClass {}
1238 main(p) { 1242 main(p) {
1239 var isVariable; 1243 var isVariable;
1240 var v = p is!1 1244 var v = p is!1
1241 }''', <String>["1+is", "1-isVariable"], failingTests: '1'); 1245 }''', <String>["1+is", "1-isVariable"], failingTests: '1');
1242 1246
1243 CompletionTestCase.buildTests('testCompletion_keyword_in', ''' 1247 CompletionTestCase.buildTests('testCompletion_keyword_in', '''
1244 class Foo { int input = 7; mth() { if (in!1) {}}}''', <String>["1+input"]); 1248 class Foo { int input = 7; mth() { if (in!1) {}}}''', <String>["1+input"]);
1245 1249
1246 CompletionTestCase.buildTests( 1250 CompletionTestCase.buildTests(
1247 'testCompletion_keyword_syntheticIdentifier', 1251 'testCompletion_keyword_syntheticIdentifier',
1248 ''' 1252 '''
1249 main() { 1253 main() {
1250 var caseVar; 1254 var caseVar;
1251 var otherVar; 1255 var otherVar;
1252 var v = case!1 1256 var v = case!1
1253 }''', <String>["1+caseVar", "1-otherVar"]); 1257 }''', <String>["1+caseVar", "1-otherVar"]);
1254 1258
1255 CompletionTestCase.buildTests('testCompletion_libraryIdentifier_atEOF', ''' 1259 CompletionTestCase.buildTests('testCompletion_libraryIdentifier_atEOF', '''
1256 library int.!1''', <String>["1-parse", "1-bool"]); 1260 library int.!1''', <String>["1-parse", "1-bool"], failingTests: '1');
1257 1261
1258 CompletionTestCase.buildTests('testCompletion_libraryIdentifier_notEOF', ''' 1262 CompletionTestCase.buildTests('testCompletion_libraryIdentifier_notEOF', '''
1259 library int.!1''', <String>["1-parse", "1-bool"]); 1263 library int.!1''', <String>["1-parse", "1-bool"], failingTests: '1');
1260 1264
1261 CompletionTestCase.buildTests( 1265 CompletionTestCase.buildTests(
1262 'testCompletion_methodRef_asArg_incompatibleFunctionType', 1266 'testCompletion_methodRef_asArg_incompatibleFunctionType',
1263 ''' 1267 '''
1264 foo( f(int p) ) {} 1268 foo( f(int p) ) {}
1265 class Functions { 1269 class Functions {
1266 static myFuncInt(int p) {} 1270 static myFuncInt(int p) {}
1267 static myFuncDouble(double p) {} 1271 static myFuncDouble(double p) {}
1268 } 1272 }
1269 bar(p) {} 1273 bar(p) {}
1270 main(p) { 1274 main(p) {
1271 foo( Functions.!1; ); 1275 foo( Functions.!1; );
1272 }''', 1276 }''',
1273 <String>[ 1277 <String>[
1274 "1+myFuncInt" /*":" + ProposalKind.METHOD_NAME*/, 1278 "1+myFuncInt" /*":" + ProposalKind.METHOD_NAME*/,
1275 "1-myFuncDouble" /*":" + ProposalKind.METHOD_NAME*/]); 1279 "1-myFuncDouble" /*":" + ProposalKind.METHOD_NAME*/],
1280 failingTests: '1');
1276 1281
1277 CompletionTestCase.buildTests( 1282 CompletionTestCase.buildTests(
1278 'testCompletion_methodRef_asArg_notFunctionType', 1283 'testCompletion_methodRef_asArg_notFunctionType',
1279 ''' 1284 '''
1280 foo( f(int p) ) {} 1285 foo( f(int p) ) {}
1281 class Functions { 1286 class Functions {
1282 static myFunc(int p) {} 1287 static myFunc(int p) {}
1283 } 1288 }
1284 bar(p) {} 1289 bar(p) {}
1285 main(p) { 1290 main(p) {
1286 foo( (int p) => Functions.!1; ); 1291 foo( (int p) => Functions.!1; );
1287 }''', 1292 }''',
1288 <String>[ 1293 <String>[
1289 "1+myFunc" /*":" + ProposalKind.METHOD*/, 1294 "1+myFunc" /*":" + ProposalKind.METHOD*/,
1290 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/]); 1295 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/],
1296 failingTests: '1');
1291 1297
1292 CompletionTestCase.buildTests( 1298 CompletionTestCase.buildTests(
1293 'testCompletion_methodRef_asArg_ofFunctionType', 1299 'testCompletion_methodRef_asArg_ofFunctionType',
1294 ''' 1300 '''
1295 foo( f(int p) ) {} 1301 foo( f(int p) ) {}
1296 class Functions { 1302 class Functions {
1297 static int myFunc(int p) {} 1303 static int myFunc(int p) {}
1298 } 1304 }
1299 main(p) { 1305 main(p) {
1300 foo(Functions.!1); 1306 foo(Functions.!1);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 class A { 1448 class A {
1443 static int FIELD_A; 1449 static int FIELD_A;
1444 static int methodA() {} 1450 static int methodA() {}
1445 } 1451 }
1446 class B extends A { 1452 class B extends A {
1447 static int FIELD_B; 1453 static int FIELD_B;
1448 static int methodB() {} 1454 static int methodB() {}
1449 } 1455 }
1450 main() { 1456 main() {
1451 B.!1; 1457 B.!1;
1452 }''', <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"]); 1458 }''',
1459 <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"],
1460 failingTests: '1');
1453 1461
1454 CompletionTestCase.buildTests( 1462 CompletionTestCase.buildTests(
1455 'testCompletion_propertyAccess_whenInstanceTarget', 1463 'testCompletion_propertyAccess_whenInstanceTarget',
1456 ''' 1464 '''
1457 class A { 1465 class A {
1458 static int FIELD; 1466 static int FIELD;
1459 int fieldA; 1467 int fieldA;
1460 } 1468 }
1461 class B { 1469 class B {
1462 A a; 1470 A a;
1463 } 1471 }
1464 class C extends A { 1472 class C extends A {
1465 int fieldC; 1473 int fieldC;
1466 } 1474 }
1467 main(B b, C c) { 1475 main(B b, C c) {
1468 b.a.!1; 1476 b.a.!1;
1469 c.!2; 1477 c.!2;
1470 }''', <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"]); 1478 }''',
1479 <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"],
1480 failingTests: '1');
1471 1481
1472 CompletionTestCase.buildTests( 1482 CompletionTestCase.buildTests(
1473 'testCompletion_return_withIdentifierPrefix', 1483 'testCompletion_return_withIdentifierPrefix',
1474 ''' 1484 '''
1475 f() { var vvv = 42; return v!1 }''', <String>["1+vvv"]); 1485 f() { var vvv = 42; return v!1 }''', <String>["1+vvv"]);
1476 1486
1477 CompletionTestCase.buildTests('testCompletion_return_withoutExpression', ''' 1487 CompletionTestCase.buildTests('testCompletion_return_withoutExpression', '''
1478 f() { var vvv = 42; return !1 }''', <String>["1+vvv"]); 1488 f() { var vvv = 42; return !1 }''', <String>["1+vvv"]);
1479 1489
1480 CompletionTestCase.buildTests('testCompletion_staticField1', ''' 1490 CompletionTestCase.buildTests('testCompletion_staticField1', '''
1481 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo wer() {x!Xc = y!Yc = MA!1 }}''', 1491 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo wer() {x!Xc = y!Yc = MA!1 }}''',
1482 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"], 1492 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"],
1483 failingTests: '234'); 1493 failingTests: '234');
1484 1494
1485 CompletionTestCase.buildTests('testCompletion_super_superType', ''' 1495 CompletionTestCase.buildTests('testCompletion_super_superType', '''
1486 class A { 1496 class A {
1487 var fa; 1497 var fa;
1488 ma() {} 1498 ma() {}
1489 } 1499 }
1490 class B extends A { 1500 class B extends A {
1491 var fb; 1501 var fb;
1492 mb() {} 1502 mb() {}
1493 main() { 1503 main() {
1494 super.!1 1504 super.!1
1495 } 1505 }
1496 }''', <String>["1+fa", "1-fb", "1+ma", "1-mb"]); 1506 }''', <String>["1+fa", "1-fb", "1+ma", "1-mb"], failingTests: '1');
1497 1507
1498 CompletionTestCase.buildTests( 1508 CompletionTestCase.buildTests(
1499 'testCompletion_superConstructorInvocation_noNamePrefix', 1509 'testCompletion_superConstructorInvocation_noNamePrefix',
1500 ''' 1510 '''
1501 class A { 1511 class A {
1502 A.fooA(); 1512 A.fooA();
1503 A.fooB(); 1513 A.fooB();
1504 A.bar(); 1514 A.bar();
1505 } 1515 }
1506 class B extends A { 1516 class B extends A {
(...skipping 11 matching lines...) Expand all
1518 class B extends A { 1528 class B extends A {
1519 B() : super.f!1 1529 B() : super.f!1
1520 }''', <String>["1+fooA", "1+fooB", "1-bar"], failingTests: '1'); 1530 }''', <String>["1+fooA", "1+fooB", "1-bar"], failingTests: '1');
1521 1531
1522 CompletionTestCase.buildTests( 1532 CompletionTestCase.buildTests(
1523 'testCompletion_this_bad_inConstructorInitializer', 1533 'testCompletion_this_bad_inConstructorInitializer',
1524 ''' 1534 '''
1525 class A { 1535 class A {
1526 var f; 1536 var f;
1527 A() : f = this.!1; 1537 A() : f = this.!1;
1528 }''', <String>["1-toString"]); 1538 }''', <String>["1-toString"], failingTests: '1');
1529 1539
1530 CompletionTestCase.buildTests( 1540 CompletionTestCase.buildTests(
1531 'testCompletion_this_bad_inFieldDeclaration', 1541 'testCompletion_this_bad_inFieldDeclaration',
1532 ''' 1542 '''
1533 class A { 1543 class A {
1534 var f = this.!1; 1544 var f = this.!1;
1535 }''', <String>["1-toString"]); 1545 }''', <String>["1-toString"], failingTests: '1');
1536 1546
1537 CompletionTestCase.buildTests('testCompletion_this_bad_inStaticMethod', ''' 1547 CompletionTestCase.buildTests('testCompletion_this_bad_inStaticMethod', '''
1538 class A { 1548 class A {
1539 static m() { 1549 static m() {
1540 this.!1; 1550 this.!1;
1541 } 1551 }
1542 }''', <String>["1-toString"]); 1552 }''', <String>["1-toString"], failingTests: '1');
1543 1553
1544 CompletionTestCase.buildTests( 1554 CompletionTestCase.buildTests(
1545 'testCompletion_this_bad_inTopLevelFunction', 1555 'testCompletion_this_bad_inTopLevelFunction',
1546 ''' 1556 '''
1547 main() { 1557 main() {
1548 this.!1; 1558 this.!1;
1549 }''', <String>["1-toString"]); 1559 }''', <String>["1-toString"], failingTests: '1');
1550 1560
1551 CompletionTestCase.buildTests( 1561 CompletionTestCase.buildTests(
1552 'testCompletion_this_bad_inTopLevelVariableDeclaration', 1562 'testCompletion_this_bad_inTopLevelVariableDeclaration',
1553 ''' 1563 '''
1554 var v = this.!1;''', <String>["1-toString"]); 1564 var v = this.!1;''', <String>["1-toString"], failingTests: '1');
1555 1565
1556 CompletionTestCase.buildTests( 1566 CompletionTestCase.buildTests(
1557 'testCompletion_this_OK_inConstructorBody', 1567 'testCompletion_this_OK_inConstructorBody',
1558 ''' 1568 '''
1559 class A { 1569 class A {
1560 var f; 1570 var f;
1561 m() {} 1571 m() {}
1562 A() { 1572 A() {
1563 this.!1; 1573 this.!1;
1564 } 1574 }
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 "7+Aclass", 1950 "7+Aclass",
1941 "7-Bclass", 1951 "7-Bclass",
1942 "8+Ctype", 1952 "8+Ctype",
1943 "9+abstract", 1953 "9+abstract",
1944 "A+with", 1954 "A+with",
1945 "B+Eclass", 1955 "B+Eclass",
1946 "B-Dclass", 1956 "B-Dclass",
1947 "B-Ctype", 1957 "B-Ctype",
1948 "C+Bclass", 1958 "C+Bclass",
1949 "C-Eclass"], 1959 "C-Eclass"],
1950 failingTests: '12359AB'); 1960 failingTests: '12345679ABC');
1951 1961
1952 // keywords 1962 // keywords
1953 CompletionTestCase.buildTests('test009', ''' 1963 CompletionTestCase.buildTests('test009', '''
1954 typedef !1dy!2namic TestFn1(); 1964 typedef !1dy!2namic TestFn1();
1955 typedef !3vo!4id TestFn2(); 1965 typedef !3vo!4id TestFn2();
1956 typ!7edef !5n!6''', 1966 typ!7edef !5n!6''',
1957 <String>[ 1967 <String>[
1958 "1+void", 1968 "1+void",
1959 "1+TestFn2", 1969 "1+TestFn2",
1960 "2+dynamic", 1970 "2+dynamic",
(...skipping 22 matching lines...) Expand all
1983 "6+List", 1993 "6+List",
1984 "7-List", 1994 "7-List",
1985 "8-List", 1995 "8-List",
1986 "9-String", 1996 "9-String",
1987 "A-String", 1997 "A-String",
1988 "B+String", 1998 "B+String",
1989 "C+List", 1999 "C+List",
1990 "C-tezetst", 2000 "C-tezetst",
1991 "D+List", 2001 "D+List",
1992 "D+test"], 2002 "D+test"],
1993 failingTests: '345C'); 2003 failingTests: '12345C');
1994 2004
1995 // name generation with conflicts 2005 // name generation with conflicts
1996 CompletionTestCase.buildTests( 2006 CompletionTestCase.buildTests(
1997 'test011', 2007 'test011',
1998 '''r2(var object, Object object1, Object !1);''', 2008 '''r2(var object, Object object1, Object !1);''',
1999 <String>["1+object2"], 2009 <String>["1+object2"],
2000 failingTests: '1'); 2010 failingTests: '1');
2001 2011
2002 // reserved words 2012 // reserved words
2003 CompletionTestCase.buildTests('test012', ''' 2013 CompletionTestCase.buildTests('test012', '''
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 "2+x", 2049 "2+x",
2040 "3+zs", 2050 "3+zs",
2041 "4+k", 2051 "4+k",
2042 "5+Q", 2052 "5+Q",
2043 "5-a", 2053 "5-a",
2044 "6+==", 2054 "6+==",
2045 "7+x", 2055 "7+x",
2046 "8+==", 2056 "8+==",
2047 "9+==", 2057 "9+==",
2048 "0+k"], 2058 "0+k"],
2049 failingTests: '689'); 2059 failingTests: '5689');
2050 2060
2051 // keywords 2061 // keywords
2052 CompletionTestCase.buildTests('test014', ''' 2062 CompletionTestCase.buildTests('test014', '''
2053 class Q { 2063 class Q {
2054 bool x; 2064 bool x;
2055 List zs; 2065 List zs;
2056 int k; 2066 int k;
2057 !Dvar a; 2067 !Dvar a;
2058 !Evoid mth() { 2068 !Evoid mth() {
2059 !1while (z) { !Gcontinue; }; 2069 !1while (z) { !Gcontinue; };
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 2148
2139 CompletionTestCase.buildTests( 2149 CompletionTestCase.buildTests(
2140 'test020', 2150 'test020',
2141 '''var x = null.!1''', 2151 '''var x = null.!1''',
2142 <String>["1+toString"], 2152 <String>["1+toString"],
2143 failingTests: '1'); 2153 failingTests: '1');
2144 2154
2145 CompletionTestCase.buildTests( 2155 CompletionTestCase.buildTests(
2146 'test021', 2156 'test021',
2147 '''var x = .!1''', 2157 '''var x = .!1''',
2148 <String>["1-toString"]); 2158 <String>["1-toString"],
2159 failingTests: '1');
2149 2160
2150 CompletionTestCase.buildTests( 2161 CompletionTestCase.buildTests(
2151 'test022', 2162 'test022',
2152 '''var x = .!1;''', 2163 '''var x = .!1;''',
2153 <String>["1-toString"]); 2164 <String>["1-toString"],
2165 failingTests: '1');
2154 2166
2155 CompletionTestCase.buildTests('test023', ''' 2167 CompletionTestCase.buildTests('test023', '''
2156 class Map{getKeys(){}} 2168 class Map{getKeys(){}}
2157 class X { 2169 class X {
2158 static x1(Map m) { 2170 static x1(Map m) {
2159 m.!1getKeys; 2171 m.!1getKeys;
2160 } 2172 }
2161 x2(Map m) { 2173 x2(Map m) {
2162 m.!2getKeys; 2174 m.!2getKeys;
2163 } 2175 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 "5+_m", 2225 "5+_m",
2214 "6+g", 2226 "6+g",
2215 "7-g", 2227 "7-g",
2216 "8-m", 2228 "8-m",
2217 "9-_m", 2229 "9-_m",
2218 "A+_m", 2230 "A+_m",
2219 "B+m", 2231 "B+m",
2220 "C+g", 2232 "C+g",
2221 "D+_m", 2233 "D+_m",
2222 "E+m", 2234 "E+m",
2223 "F+g"]); 2235 "F+g"],
2236 failingTests: '789');
2224 2237
2225 CompletionTestCase.buildTests( 2238 CompletionTestCase.buildTests(
2226 'test026', 2239 'test026',
2227 '''var aBcD; var x=ab!1''', 2240 '''var aBcD; var x=ab!1''',
2228 <String>["1+aBcD"]); 2241 <String>["1+aBcD"]);
2229 2242
2230 CompletionTestCase.buildTests( 2243 CompletionTestCase.buildTests(
2231 'test027', 2244 'test027',
2232 '''m(){try{}catch(eeee,ssss){s!1}''', 2245 '''m(){try{}catch(eeee,ssss){s!1}''',
2233 <String>["1+ssss"]); 2246 <String>["1+ssss"]);
2234 2247
2235 CompletionTestCase.buildTests( 2248 CompletionTestCase.buildTests(
2236 'test028', 2249 'test028',
2237 '''m(){var isX=3;if(is!1)''', 2250 '''m(){var isX=3;if(is!1)''',
2238 <String>["1+isX"]); 2251 <String>["1+isX"]);
2239 2252
2240 CompletionTestCase.buildTests( 2253 CompletionTestCase.buildTests(
2241 'test029', 2254 'test029',
2242 '''m(){[1].forEach((x)=>!1x);}''', 2255 '''m(){[1].forEach((x)=>!1x);}''',
2243 <String>["1+x"]); 2256 <String>["1+x"]);
2244 2257
2245 CompletionTestCase.buildTests( 2258 CompletionTestCase.buildTests(
2246 'test030', 2259 'test030',
2247 '''n(){[1].forEach((x){!1});}''', 2260 '''n(){[1].forEach((x){!1});}''',
2248 <String>["1+x"]); 2261 <String>["1+x"]);
2249 2262
2250 CompletionTestCase.buildTests( 2263 CompletionTestCase.buildTests(
2251 'test031', 2264 'test031',
2252 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''', 2265 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''',
2253 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"]); 2266 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"],
2267 failingTests: '1');
2254 2268
2255 CompletionTestCase.buildTests('test032', ''' 2269 CompletionTestCase.buildTests('test032', '''
2256 const ONE = 1; 2270 const ONE = 1;
2257 const ICHI = 10; 2271 const ICHI = 10;
2258 const UKSI = 100; 2272 const UKSI = 100;
2259 const EIN = 1000; 2273 const EIN = 1000;
2260 m() { 2274 m() {
2261 int x; 2275 int x;
2262 switch (x) { 2276 switch (x) {
2263 case !3ICHI: 2277 case !3ICHI:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 main() { 2347 main() {
2334 A1 a = new A1(); 2348 A1 a = new A1();
2335 a.field.!2 2349 a.field.!2
2336 }''', <String>["1+round", "2+round"], failingTests: '12'); 2350 }''', <String>["1+round", "2+round"], failingTests: '12');
2337 2351
2338 CompletionTestCase.buildTests('test037', ''' 2352 CompletionTestCase.buildTests('test037', '''
2339 class HttpServer{} 2353 class HttpServer{}
2340 class HttpClient{} 2354 class HttpClient{}
2341 main() { 2355 main() {
2342 new HtS!1 2356 new HtS!1
2343 }''', <String>["1+HttpServer", "1-HttpClient"]); 2357 }''', <String>["1+HttpServer", "1-HttpClient"], failingTests: '1');
2344 2358
2345 CompletionTestCase.buildTests('test038', ''' 2359 CompletionTestCase.buildTests('test038', '''
2346 class X { 2360 class X {
2347 x(){} 2361 x(){}
2348 } 2362 }
2349 class Y { 2363 class Y {
2350 y(){} 2364 y(){}
2351 } 2365 }
2352 class A<Z extends X> { 2366 class A<Z extends X> {
2353 Y ay; 2367 Y ay;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 'test_classMembers_inGetter', 2405 'test_classMembers_inGetter',
2392 '''class A { var fff; get z {ff!1}}''', 2406 '''class A { var fff; get z {ff!1}}''',
2393 <String>["1+fff"]); 2407 <String>["1+fff"]);
2394 2408
2395 CompletionTestCase.buildTests( 2409 CompletionTestCase.buildTests(
2396 'testSingle', 2410 'testSingle',
2397 '''class A {int x; !2mth() {int y = this.x;}}class B{}''', 2411 '''class A {int x; !2mth() {int y = this.x;}}class B{}''',
2398 <String>["2+B"]); 2412 <String>["2+B"]);
2399 } 2413 }
2400 } 2414 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/completion_test_support.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698