| 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.completion.support; | 5 library test.completion.support; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 7 import 'dart:collection'; | 8 import 'dart:collection'; |
| 8 | 9 |
| 10 import 'package:unittest/unittest.dart'; |
| 11 |
| 9 import 'completion_test_support.dart'; | 12 import 'completion_test_support.dart'; |
| 10 | 13 |
| 11 main() { | 14 main() { |
| 12 CompletionTestBuilder builder = new CompletionTestBuilder(); | 15 CompletionTestBuilder builder = new CompletionTestBuilder(); |
| 13 builder.buildAll(); | 16 builder.buildAll(); |
| 14 } | 17 } |
| 15 | 18 |
| 16 /** | 19 /** |
| 17 * A builder that builds the completion tests. | 20 * A builder that builds the completion tests. |
| 18 */ | 21 */ |
| 19 class CompletionTestBuilder { | 22 class CompletionTestBuilder { |
| 23 /** |
| 24 * Number of tests that have been built that are expected to pass. |
| 25 */ |
| 26 int expectedPassCount = 0; |
| 27 |
| 28 /** |
| 29 * Number of tests that have been built that are expected to fail. |
| 30 */ |
| 31 int expectedFailCount = 0; |
| 32 |
| 20 void buildAll() { | 33 void buildAll() { |
| 21 buildNumberedTests(); | 34 buildNumberedTests(); |
| 22 buildCommentSnippetTests(); | 35 buildCommentSnippetTests(); |
| 23 buildCompletionTests(); | 36 buildCompletionTests(); |
| 24 buildOtherTests(); | 37 buildOtherTests(); |
| 25 buildLibraryTests(); | 38 buildLibraryTests(); |
| 39 int testCount = expectedPassCount + expectedFailCount; |
| 40 print( |
| 41 'Total $testCount tests, of which $expectedFailCount are expected to fai
l.'); |
| 26 } | 42 } |
| 27 | 43 |
| 28 void buildCommentSnippetTests() { | 44 void buildCommentSnippetTests() { |
| 29 CompletionTestCase.buildTests('testCommentSnippets001', ''' | 45 buildTests('testCommentSnippets001', ''' |
| 30 class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA!1X;x!2c.abs();nu
m f = M!3AX;}}''', | 46 class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA!1X;x!2c.abs();nu
m f = M!3AX;}}''', |
| 31 <String>["1+MAX", "2+xc", "3+MAX"]); | 47 <String>["1+MAX", "2+xc", "3+MAX"]); |
| 32 | 48 |
| 33 CompletionTestCase.buildTests('testCommentSnippets002', ''' | 49 buildTests('testCommentSnippets002', ''' |
| 34 class Y {String x='hi';mth() {x.l!1ength;int n = 0;x!2.codeUnitAt(n!3);}}''', | 50 class Y {String x='hi';mth() {x.l!1ength;int n = 0;x!2.codeUnitAt(n!3);}}''', |
| 35 <String>["1+length", "2+x", "3+n"]); | 51 <String>["1+length", "2+x", "3+n"]); |
| 36 | 52 |
| 37 CompletionTestCase.buildTests('testCommentSnippets004', ''' | 53 buildTests('testCommentSnippets004', ''' |
| 38 class A {!1int x; !2mth() {!3int y = this.!5x!6;}}class B{}''', | 54 class A {!1int x; !2mth() {!3int y = this.!5x!6;}}class B{}''', |
| 39 <String>["1+A", "2+B", "3+x", "3-y", "5+mth", "6+x"]); | 55 <String>["1+A", "2+B", "3+x", "3-y", "5+mth", "6+x"]); |
| 40 | 56 |
| 41 CompletionTestCase.buildTests('testCommentSnippets005', ''' | 57 buildTests('testCommentSnippets005', ''' |
| 42 class Date { static Date JUN, JUL;}class X { m() { return Da!1te.JU!2L; }}''', | 58 class Date { static Date JUN, JUL;}class X { m() { return Da!1te.JU!2L; }}''', |
| 43 <String>["1+Date", "2+JUN", "2+JUL"]); | 59 <String>["1+Date", "2+JUN", "2+JUL"]); |
| 44 | 60 |
| 45 CompletionTestCase.buildTests('testCommentSnippets007', ''' | 61 buildTests('testCommentSnippets007', ''' |
| 46 class C {mth(Map x, !1) {}mtf(!2, Map x) {}m() {for (in!3t i=0; i<5; i++); A!4 x
;}}class int{}class Arrays{}''', | 62 class C {mth(Map x, !1) {}mtf(!2, Map x) {}m() {for (in!3t i=0; i<5; i++); A!4 x
;}}class int{}class Arrays{}''', |
| 47 <String>["1+bool", "2+bool", "3+int", "4+Arrays"], | 63 <String>["1+bool", "2+bool", "3+int", "4+Arrays"], |
| 48 failingTests: '3'); | 64 failingTests: '3'); |
| 49 | 65 |
| 50 CompletionTestCase.buildTests('testCommentSnippets008', ''' | 66 buildTests('testCommentSnippets008', ''' |
| 51 class Date{}final num M = Dat!1''', <String>["1+Date"]); | 67 class Date{}final num M = Dat!1''', <String>["1+Date"]); |
| 52 | 68 |
| 53 // space, char, eol are important | 69 // space, char, eol are important |
| 54 CompletionTestCase.buildTests('testCommentSnippets009', ''' | 70 buildTests('testCommentSnippets009', ''' |
| 55 class Maps{}class x extends!5 !2M!3 !4implements!6 !1\n{}''', | 71 class Maps{}class x extends!5 !2M!3 !4implements!6 !1\n{}''', |
| 56 <String>[ | 72 <String>[ |
| 57 "1+Map", | 73 "1+Map", |
| 58 "2+Maps", | 74 "2+Maps", |
| 59 "3+Maps", | 75 "3+Maps", |
| 60 "4-Maps", | 76 "4-Maps", |
| 61 "4+implements", | 77 "4+implements", |
| 62 "5-Maps", | 78 "5-Maps", |
| 63 "6-Map", | 79 "6-Map", |
| 64 "6+implements"], | 80 "6+implements"], |
| 65 failingTests: '46'); | 81 failingTests: '46'); |
| 66 | 82 |
| 67 // space, char, eol are important | 83 // space, char, eol are important |
| 68 CompletionTestCase.buildTests('testCommentSnippets010', ''' | 84 buildTests('testCommentSnippets010', ''' |
| 69 class x implements !1{}''', <String>["1+Map"]); | 85 class x implements !1{}''', <String>["1+Map"]); |
| 70 | 86 |
| 71 // space, char, eol are important | 87 // space, char, eol are important |
| 72 CompletionTestCase.buildTests('testCommentSnippets011', ''' | 88 buildTests('testCommentSnippets011', ''' |
| 73 class x implements M!1{}''', <String>["1+Map"]); | 89 class x implements M!1{}''', <String>["1+Map"]); |
| 74 | 90 |
| 75 // space, char, eol are important | 91 // space, char, eol are important |
| 76 CompletionTestCase.buildTests('testCommentSnippets012', ''' | 92 buildTests('testCommentSnippets012', ''' |
| 77 class x implements M!1\n{}''', <String>["1+Map"]); | 93 class x implements M!1\n{}''', <String>["1+Map"]); |
| 78 | 94 |
| 79 CompletionTestCase.buildTests('testCommentSnippets013', ''' | 95 buildTests('testCommentSnippets013', ''' |
| 80 class x !2{!1}!3''', <String>["1+num", "2-num", "3-num"], failingTests: '3'); | 96 class x !2{!1}!3''', <String>["1+num", "2-num", "3-num"], failingTests: '3'); |
| 81 | 97 |
| 82 // trailing space is important | 98 // trailing space is important |
| 83 CompletionTestCase.buildTests('testCommentSnippets014', ''' | 99 buildTests('testCommentSnippets014', ''' |
| 84 typedef n!1 ;''', <String>["1+num"]); | 100 typedef n!1 ;''', <String>["1+num"]); |
| 85 | 101 |
| 86 CompletionTestCase.buildTests('testCommentSnippets015', ''' | 102 buildTests('testCommentSnippets015', ''' |
| 87 class D {f(){} g(){f!1(f!2);}}''', <String>["1+f", "2+f"]); | 103 class D {f(){} g(){f!1(f!2);}}''', <String>["1+f", "2+f"]); |
| 88 | 104 |
| 89 CompletionTestCase.buildTests('testCommentSnippets016', ''' | 105 buildTests('testCommentSnippets016', ''' |
| 90 class F {m() { m(); !1}}''', <String>["1+m"]); | 106 class F {m() { m(); !1}}''', <String>["1+m"]); |
| 91 | 107 |
| 92 CompletionTestCase.buildTests('testCommentSnippets017', ''' | 108 buildTests('testCommentSnippets017', ''' |
| 93 class F {var x = !1false;}''', <String>["1+true"], failingTests: '1'); | 109 class F {var x = !1false;}''', <String>["1+true"], failingTests: '1'); |
| 94 | 110 |
| 95 CompletionTestCase.buildTests('testCommentSnippets018', ''' | 111 buildTests('testCommentSnippets018', ''' |
| 96 class Map{}class Arrays{}class C{ m(!1){} n(!2 x, q)''', | 112 class Map{}class Arrays{}class C{ m(!1){} n(!2 x, q)''', |
| 97 <String>["1+Map", "1-void", "1-null", "2+Arrays", "2-void", "2-null"], | 113 <String>["1+Map", "1-void", "1-null", "2+Arrays", "2-void", "2-null"], |
| 98 failingTests: '1'); | 114 failingTests: '1'); |
| 99 | 115 |
| 100 CompletionTestCase.buildTests('testCommentSnippets019', ''' | 116 buildTests('testCommentSnippets019', ''' |
| 101 class A{m(){Object x;x.!1/**/clear()''', <String>["1+toString"]); | 117 class A{m(){Object x;x.!1/**/clear()''', <String>["1+toString"]); |
| 102 | 118 |
| 103 CompletionTestCase.buildTests('testCommentSnippets020', ''' | 119 buildTests('testCommentSnippets020', ''' |
| 104 classMap{}class tst {var newt;void newf(){}test() {var newz;new!1/**/;}}''', | 120 classMap{}class tst {var newt;void newf(){}test() {var newz;new!1/**/;}}''', |
| 105 <String>["1+newt", "1+newf", "1+newz", "1-Map"], | 121 <String>["1+newt", "1+newf", "1+newz", "1-Map"], |
| 106 failingTests: '1'); | 122 failingTests: '1'); |
| 107 | 123 |
| 108 CompletionTestCase.buildTests('testCommentSnippets021', ''' | 124 buildTests('testCommentSnippets021', ''' |
| 109 class Map{}class tst {var newt;void newf(){}test() {var newz;new !1/**/;}}''', | 125 class Map{}class tst {var newt;void newf(){}test() {var newz;new !1/**/;}}''', |
| 110 <String>["1+Map", "1-newt"], | 126 <String>["1+Map", "1-newt"], |
| 111 failingTests: '1'); | 127 failingTests: '1'); |
| 112 | 128 |
| 113 CompletionTestCase.buildTests('testCommentSnippets022', ''' | 129 buildTests('testCommentSnippets022', ''' |
| 114 class Map{}class F{m(){new !1;}}''', <String>["1+Map"], failingTests: '1'); | 130 class Map{}class F{m(){new !1;}}''', <String>["1+Map"], failingTests: '1'); |
| 115 | 131 |
| 116 CompletionTestCase.buildTests('testCommentSnippets022a', ''' | 132 buildTests('testCommentSnippets022a', ''' |
| 117 class Map{}class F{m(){new !1''', <String>["1+Map"], failingTests: '1'); | 133 class Map{}class F{m(){new !1''', <String>["1+Map"], failingTests: '1'); |
| 118 | 134 |
| 119 CompletionTestCase.buildTests('testCommentSnippets022b', ''' | 135 buildTests('testCommentSnippets022b', ''' |
| 120 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''', | 136 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''', |
| 121 <String>["1+qq"]); | 137 <String>["1+qq"]); |
| 122 | 138 |
| 123 CompletionTestCase.buildTests('testCommentSnippets023', ''' | 139 buildTests('testCommentSnippets023', ''' |
| 124 class X {X c; X(this.!1c!3) : super() {c.!2}}''', | 140 class X {X c; X(this.!1c!3) : super() {c.!2}}''', |
| 125 <String>["1+c", "2+c", "3+c"]); | 141 <String>["1+c", "2+c", "3+c"]); |
| 126 | 142 |
| 127 CompletionTestCase.buildTests('testCommentSnippets024', ''' | 143 buildTests('testCommentSnippets024', ''' |
| 128 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>["1+x", "2+x"]); | 144 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>["1+x", "2+x"]); |
| 129 | 145 |
| 130 CompletionTestCase.buildTests('testCommentSnippets025', ''' | 146 buildTests('testCommentSnippets025', ''' |
| 131 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''', | 147 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''', |
| 132 <String>["1+q", "2+q", "3+q"], | 148 <String>["1+q", "2+q", "3+q"], |
| 133 failingTests: '123'); | 149 failingTests: '123'); |
| 134 | 150 |
| 135 CompletionTestCase.buildTests('testCommentSnippets026', ''' | 151 buildTests('testCommentSnippets026', ''' |
| 136 class List{}class a implements !1{}''', <String>["1+List"], failingTests: '1'); | 152 class List{}class a implements !1{}''', <String>["1+List"], failingTests: '1'); |
| 137 | 153 |
| 138 CompletionTestCase.buildTests('testCommentSnippets027', ''' | 154 buildTests('testCommentSnippets027', ''' |
| 139 class String{}class List{}class test <X extends !1String!2> {}''', | 155 class String{}class List{}class test <X extends !1String!2> {}''', |
| 140 <String>["1+List", "2+String", "2-List"], | 156 <String>["1+List", "2+String", "2-List"], |
| 141 failingTests: '12'); | 157 failingTests: '12'); |
| 142 | 158 |
| 143 CompletionTestCase.buildTests('testCommentSnippets028', ''' | 159 buildTests('testCommentSnippets028', ''' |
| 144 class String{}class List{}class DateTime{}typedef T Y<T extends !1>(List input);
''', | 160 class String{}class List{}class DateTime{}typedef T Y<T extends !1>(List input);
''', |
| 145 <String>["1+DateTime", "1+String"], | 161 <String>["1+DateTime", "1+String"], |
| 146 failingTests: '1'); | 162 failingTests: '1'); |
| 147 | 163 |
| 148 CompletionTestCase.buildTests('testCommentSnippets029', ''' | 164 buildTests('testCommentSnippets029', ''' |
| 149 interface A<X> default B<X extends !1List!2> {}''', | 165 interface A<X> default B<X extends !1List!2> {}''', |
| 150 <String>["1+DateTime", "2+List"]); | 166 <String>["1+DateTime", "2+List"]); |
| 151 | 167 |
| 152 CompletionTestCase.buildTests('testCommentSnippets030', ''' | 168 buildTests('testCommentSnippets030', ''' |
| 153 class Bar<T extends Foo> {const Bar(!1T!2 k);T!3 m(T!4 a, T!5 b){}final T!6 f =
null;}''', | 169 class Bar<T extends Foo> {const Bar(!1T!2 k);T!3 m(T!4 a, T!5 b){}final T!6 f =
null;}''', |
| 154 <String>["1+T", "2+T", "3+T", "4+T", "5+T", "6+T"], | 170 <String>["1+T", "2+T", "3+T", "4+T", "5+T", "6+T"], |
| 155 failingTests: '123456'); | 171 failingTests: '123456'); |
| 156 | 172 |
| 157 CompletionTestCase.buildTests('testCommentSnippets031', ''' | 173 buildTests('testCommentSnippets031', ''' |
| 158 class Bar<T extends Foo> {m(x){if (x is !1) return;if (x is!!!2)}}''', | 174 class Bar<T extends Foo> {m(x){if (x is !1) return;if (x is!!!2)}}''', |
| 159 <String>["1+Bar", "1+T", "2+T", "2+Bar"], | 175 <String>["1+Bar", "1+T", "2+T", "2+Bar"], |
| 160 failingTests: '12'); | 176 failingTests: '12'); |
| 161 | 177 |
| 162 CompletionTestCase.buildTests('testCommentSnippets032', ''' | 178 buildTests('testCommentSnippets032', ''' |
| 163 class Fit{}class Bar<T extends Fooa> {const !2F!1ara();}''', | 179 class Fit{}class Bar<T extends Fooa> {const !2F!1ara();}''', |
| 164 <String>["1+Fit", "1+Fara", "1-Bar", "2+Fit"], | 180 <String>["1+Fit", "1+Fara", "1-Bar", "2+Fit"], |
| 165 failingTests: '1'); | 181 failingTests: '1'); |
| 166 | 182 |
| 167 // Type propagation | 183 // Type propagation |
| 168 CompletionTestCase.buildTests('testCommentSnippets033', ''' | 184 buildTests('testCommentSnippets033', ''' |
| 169 class List{add(){}length(){}}t1() {var x;if (x is List) {x.!1add(3);}}''', | 185 class List{add(){}length(){}}t1() {var x;if (x is List) {x.!1add(3);}}''', |
| 170 <String>["1+add", "1+length"]); | 186 <String>["1+add", "1+length"]); |
| 171 | 187 |
| 172 // Type propagation | 188 // Type propagation |
| 173 CompletionTestCase.buildTests('testCommentSnippets035', ''' | 189 buildTests('testCommentSnippets035', ''' |
| 174 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear(
);}''', | 190 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear(
);}''', |
| 175 <String>["1+length", "2+clear"]); | 191 <String>["1+length", "2+clear"]); |
| 176 | 192 |
| 177 CompletionTestCase.buildTests('testCommentSnippets036', ''' | 193 buildTests('testCommentSnippets036', ''' |
| 178 class List{}t3() {var x=new List!1}''', <String>["1+List"], failingTests: '1'); | 194 class List{}t3() {var x=new List!1}''', <String>["1+List"], failingTests: '1'); |
| 179 | 195 |
| 180 CompletionTestCase.buildTests('testCommentSnippets037', ''' | 196 buildTests('testCommentSnippets037', ''' |
| 181 class List{factory List.from(){}}t3() {var x=new List.!1}''', | 197 class List{factory List.from(){}}t3() {var x=new List.!1}''', |
| 182 <String>["1+from"]); | 198 <String>["1+from"]); |
| 183 | 199 |
| 184 CompletionTestCase.buildTests('testCommentSnippets038', ''' | 200 buildTests('testCommentSnippets038', ''' |
| 185 f(){int xa; String s = '\$x!1';}''', <String>["1+xa"]); | 201 f(){int xa; String s = '\$x!1';}''', <String>["1+xa"]); |
| 186 | 202 |
| 187 CompletionTestCase.buildTests('testCommentSnippets038a', ''' | 203 buildTests('testCommentSnippets038a', ''' |
| 188 int xa; String s = '\$x!1\'''', <String>["1+xa"]); | 204 int xa; String s = '\$x!1\'''', <String>["1+xa"]); |
| 189 | 205 |
| 190 CompletionTestCase.buildTests('testCommentSnippets039', ''' | 206 buildTests('testCommentSnippets039', ''' |
| 191 f(){int xa; String s = '\$!1';}''', <String>["1+xa"]); | 207 f(){int xa; String s = '\$!1';}''', <String>["1+xa"]); |
| 192 | 208 |
| 193 CompletionTestCase.buildTests('testCommentSnippets039a', ''' | 209 buildTests('testCommentSnippets039a', ''' |
| 194 int xa; String s = '\$!1\'''', <String>["1+xa"]); | 210 int xa; String s = '\$!1\'''', <String>["1+xa"]); |
| 195 | 211 |
| 196 CompletionTestCase.buildTests('testCommentSnippets040', ''' | 212 buildTests('testCommentSnippets040', ''' |
| 197 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''', | 213 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''', |
| 198 <String>["1+add"]); | 214 <String>["1+add"]); |
| 199 | 215 |
| 200 CompletionTestCase.buildTests('testCommentSnippets041', ''' | 216 buildTests('testCommentSnippets041', ''' |
| 201 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''', | 217 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''', |
| 202 <String>["1+add"]); | 218 <String>["1+add"]); |
| 203 | 219 |
| 204 CompletionTestCase.buildTests('testCommentSnippets042', ''' | 220 buildTests('testCommentSnippets042', ''' |
| 205 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime.
now();d.!1WED!2;}''', | 221 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime.
now();d.!1WED!2;}''', |
| 206 <String>["1+day", "2-WED"], | 222 <String>["1+day", "2-WED"], |
| 207 failingTests: '2'); | 223 failingTests: '2'); |
| 208 | 224 |
| 209 CompletionTestCase.buildTests('testCommentSnippets043', ''' | 225 buildTests('testCommentSnippets043', ''' |
| 210 class L{var k;void.!1}''', <String>["1-k"]); | 226 class L{var k;void.!1}''', <String>["1-k"]); |
| 211 | 227 |
| 212 CompletionTestCase.buildTests('testCommentSnippets044', ''' | 228 buildTests('testCommentSnippets044', ''' |
| 213 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', | 229 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', |
| 214 <String>["1+List", "1+XXX.fisk"], | 230 <String>["1+List", "1+XXX.fisk"], |
| 215 failingTests: '1'); | 231 failingTests: '1'); |
| 216 | 232 |
| 217 CompletionTestCase.buildTests('testCommentSnippets047', ''' | 233 buildTests('testCommentSnippets047', ''' |
| 218 f(){int x;int y=!1;}''', <String>["1+x"]); | 234 f(){int x;int y=!1;}''', <String>["1+x"]); |
| 219 | 235 |
| 220 CompletionTestCase.buildTests('testCommentSnippets048', ''' | 236 buildTests('testCommentSnippets048', ''' |
| 221 import 'dart:convert' as json;f() {var x=new js!1}''', | 237 import 'dart:convert' as json;f() {var x=new js!1}''', |
| 222 <String>["1+json"], | 238 <String>["1+json"], |
| 223 failingTests: '1'); | 239 failingTests: '1'); |
| 224 | 240 |
| 225 CompletionTestCase.buildTests('testCommentSnippets049', ''' | 241 buildTests('testCommentSnippets049', ''' |
| 226 import 'dart:convert' as json; | 242 import 'dart:convert' as json; |
| 227 import 'dart:convert' as jxx; | 243 import 'dart:convert' as jxx; |
| 228 class JsonParserX{} | 244 class JsonParserX{} |
| 229 f1() {var x=new !2j!1s!3}''', | 245 f1() {var x=new !2j!1s!3}''', |
| 230 <String>[ | 246 <String>[ |
| 231 "1+json", | 247 "1+json", |
| 232 "1+jxx", | 248 "1+jxx", |
| 233 "2+json", | 249 "2+json", |
| 234 "2+jxx", | 250 "2+jxx", |
| 235 "2-JsonParser", | 251 "2-JsonParser", |
| 236 "3+json", | 252 "3+json", |
| 237 "3-jxx"], | 253 "3-jxx"], |
| 238 failingTests: '123'); | 254 failingTests: '123'); |
| 239 | 255 |
| 240 CompletionTestCase.buildTests('testCommentSnippets050', ''' | 256 buildTests('testCommentSnippets050', ''' |
| 241 class xdr { | 257 class xdr { |
| 242 xdr(); | 258 xdr(); |
| 243 const xdr.a(a,b,c); | 259 const xdr.a(a,b,c); |
| 244 xdr.b(); | 260 xdr.b(); |
| 245 f() => 3; | 261 f() => 3; |
| 246 } | 262 } |
| 247 class xa{} | 263 class xa{} |
| 248 k() { | 264 k() { |
| 249 new x!1dr().f(); | 265 new x!1dr().f(); |
| 250 const x!2dr.!3a(1, 2, 3); | 266 const x!2dr.!3a(1, 2, 3); |
| 251 }''', | 267 }''', |
| 252 <String>[ | 268 <String>[ |
| 253 "1+xdr", | 269 "1+xdr", |
| 254 "1+xa", | 270 "1+xa", |
| 255 "1+xdr.a", | 271 "1+xdr.a", |
| 256 "1+xdr.b", | 272 "1+xdr.b", |
| 257 "2-xa", | 273 "2-xa", |
| 258 "2-xdr", | 274 "2-xdr", |
| 259 "2+xdr.a", | 275 "2+xdr.a", |
| 260 "2-xdr.b", | 276 "2-xdr.b", |
| 261 "3-b", | 277 "3-b", |
| 262 "3+a"], | 278 "3+a"], |
| 263 failingTests: '123'); | 279 failingTests: '123'); |
| 264 | 280 |
| 265 // Type propagation. | 281 // Type propagation. |
| 266 CompletionTestCase.buildTests('testCommentSnippets051', ''' | 282 buildTests('testCommentSnippets051', ''' |
| 267 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 283 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 268 void r() { | 284 void r() { |
| 269 var v; | 285 var v; |
| 270 if (v is String) { | 286 if (v is String) { |
| 271 v.!1length; | 287 v.!1length; |
| 272 v.!2getKeys; | 288 v.!2getKeys; |
| 273 } | 289 } |
| 274 }''', <String>["1+length", "2-getKeys"], failingTests: '1'); | 290 }''', <String>["1+length", "2-getKeys"], failingTests: '1'); |
| 275 | 291 |
| 276 // Type propagation. | 292 // Type propagation. |
| 277 CompletionTestCase.buildTests('testCommentSnippets052', ''' | 293 buildTests('testCommentSnippets052', ''' |
| 278 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 294 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 279 void r() { | 295 void r() { |
| 280 List<String> values = ['a','b','c']; | 296 List<String> values = ['a','b','c']; |
| 281 for (var v in values) { | 297 for (var v in values) { |
| 282 v.!1toUpperCase; | 298 v.!1toUpperCase; |
| 283 v.!2getKeys; | 299 v.!2getKeys; |
| 284 } | 300 } |
| 285 }''', <String>["1+toUpperCase", "2-getKeys"], failingTests: '1'); | 301 }''', <String>["1+toUpperCase", "2-getKeys"], failingTests: '1'); |
| 286 | 302 |
| 287 // Type propagation. | 303 // Type propagation. |
| 288 CompletionTestCase.buildTests('testCommentSnippets053', ''' | 304 buildTests('testCommentSnippets053', ''' |
| 289 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 305 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 290 void r() { | 306 void r() { |
| 291 var v; | 307 var v; |
| 292 while (v is String) { | 308 while (v is String) { |
| 293 v.!1toUpperCase; | 309 v.!1toUpperCase; |
| 294 v.!2getKeys; | 310 v.!2getKeys; |
| 295 } | 311 } |
| 296 }''', <String>["1+toUpperCase", "2-getKeys"], failingTests: '1'); | 312 }''', <String>["1+toUpperCase", "2-getKeys"], failingTests: '1'); |
| 297 | 313 |
| 298 CompletionTestCase.buildTests('testCommentSnippets054', ''' | 314 buildTests('testCommentSnippets054', ''' |
| 299 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 315 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 300 void r() { | 316 void r() { |
| 301 var v; | 317 var v; |
| 302 for (; v is String; v.!1isEmpty) { | 318 for (; v is String; v.!1isEmpty) { |
| 303 v.!2toUpperCase; | 319 v.!2toUpperCase; |
| 304 v.!3getKeys; | 320 v.!3getKeys; |
| 305 } | 321 } |
| 306 }''', <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"], failingTests: '12'); | 322 }''', <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"], failingTests: '12'); |
| 307 | 323 |
| 308 CompletionTestCase.buildTests('testCommentSnippets055', ''' | 324 buildTests('testCommentSnippets055', ''' |
| 309 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 325 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 310 void r() { | 326 void r() { |
| 311 String v; | 327 String v; |
| 312 if (v is Object) { | 328 if (v is Object) { |
| 313 v.!1toUpperCase; | 329 v.!1toUpperCase; |
| 314 } | 330 } |
| 315 }''', <String>["1+toUpperCase"]); | 331 }''', <String>["1+toUpperCase"]); |
| 316 | 332 |
| 317 // Type propagation. | 333 // Type propagation. |
| 318 CompletionTestCase.buildTests('testCommentSnippets056', ''' | 334 buildTests('testCommentSnippets056', ''' |
| 319 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 335 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 320 void f(var v) { | 336 void f(var v) { |
| 321 if (v is!! String) { | 337 if (v is!! String) { |
| 322 return; | 338 return; |
| 323 } | 339 } |
| 324 v.!1toUpperCase; | 340 v.!1toUpperCase; |
| 325 }''', <String>["1+toUpperCase"], failingTests: '1'); | 341 }''', <String>["1+toUpperCase"], failingTests: '1'); |
| 326 | 342 |
| 327 // Type propagation. | 343 // Type propagation. |
| 328 CompletionTestCase.buildTests('testCommentSnippets057', ''' | 344 buildTests('testCommentSnippets057', ''' |
| 329 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 345 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 330 void f(var v) { | 346 void f(var v) { |
| 331 if ((v as String).length == 0) { | 347 if ((v as String).length == 0) { |
| 332 v.!1toUpperCase; | 348 v.!1toUpperCase; |
| 333 } | 349 } |
| 334 }''', <String>["1+toUpperCase"], failingTests: '1'); | 350 }''', <String>["1+toUpperCase"], failingTests: '1'); |
| 335 | 351 |
| 336 CompletionTestCase.buildTests('testCommentSnippets058', ''' | 352 buildTests('testCommentSnippets058', ''' |
| 337 typedef vo!2id callback(int k); | 353 typedef vo!2id callback(int k); |
| 338 void x(callback q){} | 354 void x(callback q){} |
| 339 void r() { | 355 void r() { |
| 340 callback v; | 356 callback v; |
| 341 x(!1); | 357 x(!1); |
| 342 }''', <String>["1+v", "2+void"], failingTests: '2'); | 358 }''', <String>["1+v", "2+void"], failingTests: '2'); |
| 343 | 359 |
| 344 CompletionTestCase.buildTests('testCommentSnippets059', ''' | 360 buildTests('testCommentSnippets059', ''' |
| 345 f(){((int x) => x+4).!1call(1);}''', <String>["1-call"]); | 361 f(){((int x) => x+4).!1call(1);}''', <String>["1-call"]); |
| 346 | 362 |
| 347 CompletionTestCase.buildTests('testCommentSnippets060', ''' | 363 buildTests('testCommentSnippets060', ''' |
| 348 class Map{} | 364 class Map{} |
| 349 abstract class MM extends Map{factory MM() => new Map();} | 365 abstract class MM extends Map{factory MM() => new Map();} |
| 350 class Z { | 366 class Z { |
| 351 MM x; | 367 MM x; |
| 352 f() { | 368 f() { |
| 353 x!1 | 369 x!1 |
| 354 } | 370 } |
| 355 }''', <String>["1+x", "1-x[]"]); | 371 }''', <String>["1+x", "1-x[]"]); |
| 356 | 372 |
| 357 CompletionTestCase.buildTests('testCommentSnippets061', ''' | 373 buildTests('testCommentSnippets061', ''' |
| 358 class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''', | 374 class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''', |
| 359 <String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]); | 375 <String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]); |
| 360 | 376 |
| 361 // Type propagation. | 377 // Type propagation. |
| 362 CompletionTestCase.buildTests('testCommentSnippets063', ''' | 378 buildTests('testCommentSnippets063', ''' |
| 363 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} | 379 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge
tKeys(){}} |
| 364 void r(var v) { | 380 void r(var v) { |
| 365 v.!1toUpperCase; | 381 v.!1toUpperCase; |
| 366 assert(v is String); | 382 assert(v is String); |
| 367 v.!2toUpperCase; | 383 v.!2toUpperCase; |
| 368 }''', <String>["1-toUpperCase", "2+toUpperCase"], failingTests: '2'); | 384 }''', <String>["1-toUpperCase", "2+toUpperCase"], failingTests: '2'); |
| 369 | 385 |
| 370 CompletionTestCase.buildTests('testCommentSnippets064', ''' | 386 buildTests('testCommentSnippets064', ''' |
| 371 class Spline { | 387 class Spline { |
| 372 Line c; | 388 Line c; |
| 373 Spline a() { | 389 Spline a() { |
| 374 return this; | 390 return this; |
| 375 } | 391 } |
| 376 Line b() { | 392 Line b() { |
| 377 return null; | 393 return null; |
| 378 } | 394 } |
| 379 Spline f() { | 395 Spline f() { |
| 380 Line x = new Line(); | 396 Line x = new Line(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 397 "1-g", | 413 "1-g", |
| 398 "2-h", | 414 "2-h", |
| 399 "3+b", | 415 "3+b", |
| 400 "4+c", | 416 "4+c", |
| 401 "5+a", | 417 "5+a", |
| 402 "6+c", | 418 "6+c", |
| 403 "7+g", | 419 "7+g", |
| 404 "8+j", | 420 "8+j", |
| 405 "9+h"]); | 421 "9+h"]); |
| 406 | 422 |
| 407 CompletionTestCase.buildTests('testCommentSnippets065', ''' | 423 buildTests('testCommentSnippets065', ''' |
| 408 class Spline { | 424 class Spline { |
| 409 Line c; | 425 Line c; |
| 410 Spline a() { | 426 Spline a() { |
| 411 return this; | 427 return this; |
| 412 } | 428 } |
| 413 Line b() { | 429 Line b() { |
| 414 return null; | 430 return null; |
| 415 } | 431 } |
| 416 Spline f() { | 432 Spline f() { |
| 417 Line x = new Line(); | 433 Line x = new Line(); |
| 418 x.h()..!1; | 434 x.h()..!1; |
| 419 } | 435 } |
| 420 } | 436 } |
| 421 class Line { | 437 class Line { |
| 422 Spline j; | 438 Spline j; |
| 423 Line g() { | 439 Line g() { |
| 424 return this; | 440 return this; |
| 425 } | 441 } |
| 426 Spline h() { | 442 Spline h() { |
| 427 return null; | 443 return null; |
| 428 } | 444 } |
| 429 }''', <String>["1+a"]); | 445 }''', <String>["1+a"]); |
| 430 | 446 |
| 431 CompletionTestCase.buildTests('testCommentSnippets066', ''' | 447 buildTests('testCommentSnippets066', ''' |
| 432 class Spline { | 448 class Spline { |
| 433 Line c; | 449 Line c; |
| 434 Spline a() { | 450 Spline a() { |
| 435 return this; | 451 return this; |
| 436 } | 452 } |
| 437 Line b() { | 453 Line b() { |
| 438 return null; | 454 return null; |
| 439 } | 455 } |
| 440 Spline f() { | 456 Spline f() { |
| 441 Line x = new Line(); | 457 Line x = new Line(); |
| 442 x.h()..a()..!1; | 458 x.h()..a()..!1; |
| 443 } | 459 } |
| 444 } | 460 } |
| 445 class Line { | 461 class Line { |
| 446 Spline j; | 462 Spline j; |
| 447 Line g() { | 463 Line g() { |
| 448 return this; | 464 return this; |
| 449 } | 465 } |
| 450 Spline h() { | 466 Spline h() { |
| 451 return null; | 467 return null; |
| 452 } | 468 } |
| 453 }''', <String>["1+b"]); | 469 }''', <String>["1+b"]); |
| 454 | 470 |
| 455 CompletionTestCase.buildTests('testCommentSnippets067', ''' | 471 buildTests('testCommentSnippets067', ''' |
| 456 class Spline { | 472 class Spline { |
| 457 Line c; | 473 Line c; |
| 458 Spline a() { | 474 Spline a() { |
| 459 return this; | 475 return this; |
| 460 } | 476 } |
| 461 Line b() { | 477 Line b() { |
| 462 return null; | 478 return null; |
| 463 } | 479 } |
| 464 Spline f() { | 480 Spline f() { |
| 465 Line x = new Line(); | 481 Line x = new Line(); |
| 466 x.h()..a()..c..!1; | 482 x.h()..a()..c..!1; |
| 467 } | 483 } |
| 468 } | 484 } |
| 469 class Line { | 485 class Line { |
| 470 Spline j; | 486 Spline j; |
| 471 Line g() { | 487 Line g() { |
| 472 return this; | 488 return this; |
| 473 } | 489 } |
| 474 Spline h() { | 490 Spline h() { |
| 475 return null; | 491 return null; |
| 476 } | 492 } |
| 477 }''', <String>["1+b"]); | 493 }''', <String>["1+b"]); |
| 478 | 494 |
| 479 CompletionTestCase.buildTests('testCommentSnippets068', ''' | 495 buildTests('testCommentSnippets068', ''' |
| 480 class Spline { | 496 class Spline { |
| 481 Line c; | 497 Line c; |
| 482 Spline a() { | 498 Spline a() { |
| 483 return this; | 499 return this; |
| 484 } | 500 } |
| 485 Line b() { | 501 Line b() { |
| 486 return null; | 502 return null; |
| 487 } | 503 } |
| 488 Spline f() { | 504 Spline f() { |
| 489 Line x = new Line(); | 505 Line x = new Line(); |
| 490 x.j..b()..c..!1; | 506 x.j..b()..c..!1; |
| 491 } | 507 } |
| 492 } | 508 } |
| 493 class Line { | 509 class Line { |
| 494 Spline j; | 510 Spline j; |
| 495 Line g() { | 511 Line g() { |
| 496 return this; | 512 return this; |
| 497 } | 513 } |
| 498 Spline h() { | 514 Spline h() { |
| 499 return null; | 515 return null; |
| 500 } | 516 } |
| 501 }''', <String>["1+c"]); | 517 }''', <String>["1+c"]); |
| 502 | 518 |
| 503 CompletionTestCase.buildTests('testCommentSnippets069', ''' | 519 buildTests('testCommentSnippets069', ''' |
| 504 class Spline { | 520 class Spline { |
| 505 Line c; | 521 Line c; |
| 506 Spline a() { | 522 Spline a() { |
| 507 return this; | 523 return this; |
| 508 } | 524 } |
| 509 Line b() { | 525 Line b() { |
| 510 return null; | 526 return null; |
| 511 } | 527 } |
| 512 Spline f() { | 528 Spline f() { |
| 513 Line x = new Line(); | 529 Line x = new Line(); |
| 514 x.j..b()..!1; | 530 x.j..b()..!1; |
| 515 } | 531 } |
| 516 } | 532 } |
| 517 class Line { | 533 class Line { |
| 518 Spline j; | 534 Spline j; |
| 519 Line g() { | 535 Line g() { |
| 520 return this; | 536 return this; |
| 521 } | 537 } |
| 522 Spline h() { | 538 Spline h() { |
| 523 return null; | 539 return null; |
| 524 } | 540 } |
| 525 }''', <String>["1+c"]); | 541 }''', <String>["1+c"]); |
| 526 | 542 |
| 527 CompletionTestCase.buildTests('testCommentSnippets070', ''' | 543 buildTests('testCommentSnippets070', ''' |
| 528 class Spline { | 544 class Spline { |
| 529 Line c; | 545 Line c; |
| 530 Spline a() { | 546 Spline a() { |
| 531 return this; | 547 return this; |
| 532 } | 548 } |
| 533 Line b() { | 549 Line b() { |
| 534 return null; | 550 return null; |
| 535 } | 551 } |
| 536 Spline f() { | 552 Spline f() { |
| 537 Line x = new Line(); | 553 Line x = new Line(); |
| 538 x.j..!1; | 554 x.j..!1; |
| 539 } | 555 } |
| 540 } | 556 } |
| 541 class Line { | 557 class Line { |
| 542 Spline j; | 558 Spline j; |
| 543 Line g() { | 559 Line g() { |
| 544 return this; | 560 return this; |
| 545 } | 561 } |
| 546 Spline h() { | 562 Spline h() { |
| 547 return null; | 563 return null; |
| 548 } | 564 } |
| 549 }''', <String>["1+b"]); | 565 }''', <String>["1+b"]); |
| 550 | 566 |
| 551 CompletionTestCase.buildTests('testCommentSnippets072', ''' | 567 buildTests('testCommentSnippets072', ''' |
| 552 class X { | 568 class X { |
| 553 int _p; | 569 int _p; |
| 554 set p(int x) => _p = x; | 570 set p(int x) => _p = x; |
| 555 } | 571 } |
| 556 f() { | 572 f() { |
| 557 X x = new X(); | 573 X x = new X(); |
| 558 x.!1p = 3; | 574 x.!1p = 3; |
| 559 }''', <String>["1+p"]); | 575 }''', <String>["1+p"]); |
| 560 | 576 |
| 561 CompletionTestCase.buildTests('testCommentSnippets073', ''' | 577 buildTests('testCommentSnippets073', ''' |
| 562 class X { | 578 class X { |
| 563 m() { | 579 m() { |
| 564 JSON.stri!1; | 580 JSON.stri!1; |
| 565 X f = null; | 581 X f = null; |
| 566 } | 582 } |
| 567 } | 583 } |
| 568 class JSON { | 584 class JSON { |
| 569 static stringify() {} | 585 static stringify() {} |
| 570 }''', <String>["1+stringify"]); | 586 }''', <String>["1+stringify"]); |
| 571 | 587 |
| 572 CompletionTestCase.buildTests('testCommentSnippets074', ''' | 588 buildTests('testCommentSnippets074', ''' |
| 573 class X { | 589 class X { |
| 574 m() { | 590 m() { |
| 575 _x!1 | 591 _x!1 |
| 576 } | 592 } |
| 577 _x1(){} | 593 _x1(){} |
| 578 }''', <String>["1+_x1"]); | 594 }''', <String>["1+_x1"]); |
| 579 | 595 |
| 580 CompletionTestCase.buildTests('testCommentSnippets075', ''' | 596 buildTests('testCommentSnippets075', ''' |
| 581 p(x)=>0;var E;f(q)=>!1p(!2E);''', <String>["1+p", "2+E"]); | 597 p(x)=>0;var E;f(q)=>!1p(!2E);''', <String>["1+p", "2+E"]); |
| 582 | 598 |
| 583 CompletionTestCase.buildTests('testCommentSnippets076', ''' | 599 buildTests('testCommentSnippets076', ''' |
| 584 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3int>>();}''', | 600 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3int>>();}''', |
| 585 <String>["1+List", "2+int", "3+int"], | 601 <String>["1+List", "2+int", "3+int"], |
| 586 failingTests: '123'); | 602 failingTests: '123'); |
| 587 | 603 |
| 588 CompletionTestCase.buildTests('testCommentSnippets076a', ''' | 604 buildTests('testCommentSnippets076a', ''' |
| 589 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3>>();}''', | 605 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i
n!2t>>,List<!3>>();}''', |
| 590 <String>["1+List", "2+int", "3+int"], | 606 <String>["1+List", "2+int", "3+int"], |
| 591 failingTests: '123'); | 607 failingTests: '123'); |
| 592 | 608 |
| 593 CompletionTestCase.buildTests('testCommentSnippets077', ''' | 609 buildTests('testCommentSnippets077', ''' |
| 594 class FileMode { | 610 class FileMode { |
| 595 static const READ = const FileMode._internal(0); | 611 static const READ = const FileMode._internal(0); |
| 596 static const WRITE = const FileMode._internal(1); | 612 static const WRITE = const FileMode._internal(1); |
| 597 static const APPEND = const FileMode._internal(2); | 613 static const APPEND = const FileMode._internal(2); |
| 598 const FileMode._internal(int this._mode); | 614 const FileMode._internal(int this._mode); |
| 599 factory FileMode._internal1(int this._mode); | 615 factory FileMode._internal1(int this._mode); |
| 600 factory FileMode(_mode); | 616 factory FileMode(_mode); |
| 601 final int _mode; | 617 final int _mode; |
| 602 } | 618 } |
| 603 class File { | 619 class File { |
| 604 factory File(String path) => null; | 620 factory File(String path) => null; |
| 605 factory File.fromPath(Path path) => null; | 621 factory File.fromPath(Path path) => null; |
| 606 } | 622 } |
| 607 f() => new Fil!1''', | 623 f() => new Fil!1''', |
| 608 <String>[ | 624 <String>[ |
| 609 "1+File", | 625 "1+File", |
| 610 "1+File.fromPath", | 626 "1+File.fromPath", |
| 611 "1+FileMode", | 627 "1+FileMode", |
| 612 "1+FileMode._internal1", | 628 "1+FileMode._internal1", |
| 613 "1+FileMode._internal"], | 629 "1+FileMode._internal"], |
| 614 failingTests: '1'); | 630 failingTests: '1'); |
| 615 | 631 |
| 616 CompletionTestCase.buildTests('testCommentSnippets078', ''' | 632 buildTests('testCommentSnippets078', ''' |
| 617 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''', | 633 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''', |
| 618 <String>["1+from", "1-clear"]); // static method, instance method | 634 <String>["1+from", "1-clear"]); // static method, instance method |
| 619 | 635 |
| 620 CompletionTestCase.buildTests('testCommentSnippets079', ''' | 636 buildTests('testCommentSnippets079', ''' |
| 621 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''', | 637 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''', |
| 622 <String>["1-from", "1+clear"], | 638 <String>["1-from", "1+clear"], |
| 623 failingTests: '1'); // static method, instance method | 639 failingTests: '1'); // static method, instance method |
| 624 | 640 |
| 625 CompletionTestCase.buildTests('testCommentSnippets080', ''' | 641 buildTests('testCommentSnippets080', ''' |
| 626 class RuntimeError{var message;}void main() { RuntimeError.!1 }''', | 642 class RuntimeError{var message;}void main() { RuntimeError.!1 }''', |
| 627 <String>["1-message"]); // field | 643 <String>["1-message"]); // field |
| 628 | 644 |
| 629 CompletionTestCase.buildTests('testCommentSnippets081', ''' | 645 buildTests('testCommentSnippets081', ''' |
| 630 class Foo {this.!1}''', <String>["1-Object"], failingTests: '1'); | 646 class Foo {this.!1}''', <String>["1-Object"], failingTests: '1'); |
| 631 | 647 |
| 632 CompletionTestCase.buildTests('testCommentSnippets082', ''' | 648 buildTests('testCommentSnippets082', ''' |
| 633 class HttpRequest {} | 649 class HttpRequest {} |
| 634 class HttpResponse {} | 650 class HttpResponse {} |
| 635 main() { | 651 main() { |
| 636 var v = (HttpRequest req, HttpResp!1) | 652 var v = (HttpRequest req, HttpResp!1) |
| 637 }''', <String>["1+HttpResponse"]); | 653 }''', <String>["1+HttpResponse"]); |
| 638 | 654 |
| 639 CompletionTestCase.buildTests('testCommentSnippets083', ''' | 655 buildTests('testCommentSnippets083', ''' |
| 640 main() {(.!1)}''', <String>["1-toString"], failingTests: '1'); | 656 main() {(.!1)}''', <String>["1-toString"], failingTests: '1'); |
| 641 | 657 |
| 642 CompletionTestCase.buildTests('testCommentSnippets083a', ''' | 658 buildTests('testCommentSnippets083a', ''' |
| 643 main() { .!1 }''', <String>["1-toString"], failingTests: '1'); | 659 main() { .!1 }''', <String>["1-toString"], failingTests: '1'); |
| 644 | 660 |
| 645 CompletionTestCase.buildTests('testCommentSnippets083b', ''' | 661 buildTests('testCommentSnippets083b', ''' |
| 646 main() { null.!1 }''', <String>["1+toString"], failingTests: '1'); | 662 main() { null.!1 }''', <String>["1+toString"], failingTests: '1'); |
| 647 | 663 |
| 648 CompletionTestCase.buildTests('testCommentSnippets084', ''' | 664 buildTests('testCommentSnippets084', ''' |
| 649 class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''', | 665 class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''', |
| 650 <String>["1+Map", "2+List", "2-Map", "3+List", "4+Map", "4-List"], | 666 <String>["1+Map", "2+List", "2-Map", "3+List", "4+Map", "4-List"], |
| 651 failingTests: '1234'); | 667 failingTests: '1234'); |
| 652 | 668 |
| 653 CompletionTestCase.buildTests('testCommentSnippets085', ''' | 669 buildTests('testCommentSnippets085', ''' |
| 654 class List{}class Map{}class Z extends List with !1Ma!2p {}''', | 670 class List{}class Map{}class Z extends List with !1Ma!2p {}''', |
| 655 <String>["1+List", "1+Map", "2+Map", "2-List"], | 671 <String>["1+List", "1+Map", "2+Map", "2-List"], |
| 656 failingTests: '12'); | 672 failingTests: '12'); |
| 657 | 673 |
| 658 CompletionTestCase.buildTests('testCommentSnippets086', ''' | 674 buildTests('testCommentSnippets086', ''' |
| 659 class Q{f(){xy() {!2};x!1y();}}''', | 675 class Q{f(){xy() {!2};x!1y();}}''', |
| 660 <String>["1+xy", "2+f", "2-xy"], | 676 <String>["1+xy", "2+f", "2-xy"], |
| 661 failingTests: '2'); | 677 failingTests: '2'); |
| 662 | 678 |
| 663 CompletionTestCase.buildTests('testCommentSnippets087', ''' | 679 buildTests('testCommentSnippets087', ''' |
| 664 class Map{}class Q extends Object with !1Map {}''', | 680 class Map{}class Q extends Object with !1Map {}''', |
| 665 <String>["1+Map", "1-HashMap"], | 681 <String>["1+Map", "1-HashMap"], |
| 666 failingTests: '1'); | 682 failingTests: '1'); |
| 667 | 683 |
| 668 CompletionTestCase.buildTests('testCommentSnippets088', ''' | 684 buildTests('testCommentSnippets088', ''' |
| 669 class A { | 685 class A { |
| 670 int f; | 686 int f; |
| 671 B m(){} | 687 B m(){} |
| 672 } | 688 } |
| 673 class B extends A { | 689 class B extends A { |
| 674 num f; | 690 num f; |
| 675 A m(){} | 691 A m(){} |
| 676 } | 692 } |
| 677 class Z { | 693 class Z { |
| 678 B q; | 694 B q; |
| 679 f() {q.!1} | 695 f() {q.!1} |
| 680 }''', <String>["1+f", "1+m"]); // f->num, m()->A | 696 }''', <String>["1+f", "1+m"]); // f->num, m()->A |
| 681 | 697 |
| 682 CompletionTestCase.buildTests('testCommentSnippets089', ''' | 698 buildTests('testCommentSnippets089', ''' |
| 683 class Q { | 699 class Q { |
| 684 fqe() { | 700 fqe() { |
| 685 xya() { | 701 xya() { |
| 686 xyb() { | 702 xyb() { |
| 687 !1 | 703 !1 |
| 688 } | 704 } |
| 689 !3 xyb(); | 705 !3 xyb(); |
| 690 }; | 706 }; |
| 691 xza() { | 707 xza() { |
| 692 !2 | 708 !2 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 "4-xyb", | 740 "4-xyb", |
| 725 "4+xza", | 741 "4+xza", |
| 726 "5+fqe", | 742 "5+fqe", |
| 727 "5+fqi", | 743 "5+fqi", |
| 728 "5+Q", | 744 "5+Q", |
| 729 "5-xya", | 745 "5-xya", |
| 730 "5-xyb", | 746 "5-xyb", |
| 731 "5-xza"], | 747 "5-xza"], |
| 732 failingTests: '123'); | 748 failingTests: '123'); |
| 733 | 749 |
| 734 CompletionTestCase.buildTests('testCommentSnippets090', ''' | 750 buildTests('testCommentSnippets090', ''' |
| 735 class X { f() { var a = 'x'; a.!1 }}''', | 751 class X { f() { var a = 'x'; a.!1 }}''', |
| 736 <String>["1+length"], | 752 <String>["1+length"], |
| 737 failingTests: '1'); | 753 failingTests: '1'); |
| 738 } | 754 } |
| 739 | 755 |
| 740 void buildCompletionTests() { | 756 void buildCompletionTests() { |
| 741 CompletionTestCase.buildTests('testCompletion_alias_field', ''' | 757 buildTests('testCompletion_alias_field', ''' |
| 742 typedef int fnint(int k); fn!1int x;''', <String>["1+fnint"]); | 758 typedef int fnint(int k); fn!1int x;''', <String>["1+fnint"]); |
| 743 | 759 |
| 744 CompletionTestCase.buildTests('testCompletion_annotation_argumentList', ''' | 760 buildTests('testCompletion_annotation_argumentList', ''' |
| 745 class AAA {", | 761 class AAA {", |
| 746 const AAA({int aaa, int bbb});", | 762 const AAA({int aaa, int bbb});", |
| 747 }", | 763 }", |
| 748 ", | 764 ", |
| 749 @AAA(!1) | 765 @AAA(!1) |
| 750 main() { | 766 main() { |
| 751 }''', | 767 }''', |
| 752 <String>["1+AAA" /*":" + ProposalKind.ARGUMENT_LIST*/, "1+aaa", "1+bbb"]
, | 768 <String>["1+AAA" /*":" + ProposalKind.ARGUMENT_LIST*/, "1+aaa", "1+bbb"]
, |
| 753 failingTests: '1'); | 769 failingTests: '1'); |
| 754 | 770 |
| 755 CompletionTestCase.buildTests('testCompletion_annotation_topLevelVar', ''' | 771 buildTests('testCompletion_annotation_topLevelVar', ''' |
| 756 const fooConst = null; | 772 const fooConst = null; |
| 757 final fooNotConst = null; | 773 final fooNotConst = null; |
| 758 const bar = null; | 774 const bar = null; |
| 759 | 775 |
| 760 @foo!1 | 776 @foo!1 |
| 761 main() { | 777 main() { |
| 762 }''', <String>["1+fooConst", "1-fooNotConst", "1-bar"], failingTests: '1'); | 778 }''', <String>["1+fooConst", "1-fooNotConst", "1-bar"], failingTests: '1'); |
| 763 | 779 |
| 764 CompletionTestCase.buildTests('testCompletion_annotation_type', ''' | 780 buildTests('testCompletion_annotation_type', ''' |
| 765 class AAA { | 781 class AAA { |
| 766 const AAA({int a, int b}); | 782 const AAA({int a, int b}); |
| 767 const AAA.nnn(int c, int d); | 783 const AAA.nnn(int c, int d); |
| 768 } | 784 } |
| 769 @AAA!1 | 785 @AAA!1 |
| 770 main() { | 786 main() { |
| 771 }''', | 787 }''', |
| 772 <String>[ | 788 <String>[ |
| 773 "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/, | 789 "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/, |
| 774 "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/], | 790 "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/], |
| 775 failingTests: '1'); | 791 failingTests: '1'); |
| 776 | 792 |
| 777 CompletionTestCase.buildTests( | 793 buildTests('testCompletion_annotation_type_inClass_withoutMember', ''' |
| 778 'testCompletion_annotation_type_inClass_withoutMember', | |
| 779 ''' | |
| 780 class AAA { | 794 class AAA { |
| 781 const AAA(); | 795 const AAA(); |
| 782 } | 796 } |
| 783 | 797 |
| 784 class C { | 798 class C { |
| 785 @A!1 | 799 @A!1 |
| 786 }''', <String>["1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/]); | 800 }''', <String>["1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/]); |
| 787 | 801 |
| 788 CompletionTestCase.buildTests('testCompletion_argument_typeName', ''' | 802 buildTests('testCompletion_argument_typeName', ''' |
| 789 class Enum { | 803 class Enum { |
| 790 static Enum FOO = new Enum(); | 804 static Enum FOO = new Enum(); |
| 791 } | 805 } |
| 792 f(Enum e) {} | 806 f(Enum e) {} |
| 793 main() { | 807 main() { |
| 794 f(En!1); | 808 f(En!1); |
| 795 }''', <String>["1+Enum"]); | 809 }''', <String>["1+Enum"]); |
| 796 | 810 |
| 797 CompletionTestCase.buildTests('testCompletion_arguments_ignoreEmpty', ''' | 811 buildTests('testCompletion_arguments_ignoreEmpty', ''' |
| 798 class A { | 812 class A { |
| 799 test() {} | 813 test() {} |
| 800 } | 814 } |
| 801 main(A a) { | 815 main(A a) { |
| 802 a.test(!1); | 816 a.test(!1); |
| 803 }''', <String>["1-test"]); | 817 }''', <String>["1-test"]); |
| 804 | 818 |
| 805 CompletionTestCase.buildTests('testCompletion_as_asIdentifierPrefix', ''' | 819 buildTests('testCompletion_as_asIdentifierPrefix', ''' |
| 806 main(p) { | 820 main(p) { |
| 807 var asVisible; | 821 var asVisible; |
| 808 var v = as!1; | 822 var v = as!1; |
| 809 }''', <String>["1+asVisible"]); | 823 }''', <String>["1+asVisible"]); |
| 810 | 824 |
| 811 CompletionTestCase.buildTests( | 825 buildTests('testCompletion_as_asPrefixedIdentifierStart', ''' |
| 812 'testCompletion_as_asPrefixedIdentifierStart', | |
| 813 ''' | |
| 814 class A { | 826 class A { |
| 815 var asVisible; | 827 var asVisible; |
| 816 } | 828 } |
| 817 | 829 |
| 818 main(A p) { | 830 main(A p) { |
| 819 var v = p.as!1; | 831 var v = p.as!1; |
| 820 }''', <String>["1+asVisible"]); | 832 }''', <String>["1+asVisible"]); |
| 821 | 833 |
| 822 CompletionTestCase.buildTests('testCompletion_as_incompleteStatement', ''' | 834 buildTests('testCompletion_as_incompleteStatement', ''' |
| 823 class MyClass {} | 835 class MyClass {} |
| 824 main(p) { | 836 main(p) { |
| 825 var justSomeVar; | 837 var justSomeVar; |
| 826 var v = p as !1 | 838 var v = p as !1 |
| 827 }''', <String>["1+MyClass", "1-justSomeVar"], failingTests: '1'); | 839 }''', <String>["1+MyClass", "1-justSomeVar"], failingTests: '1'); |
| 828 | 840 |
| 829 CompletionTestCase.buildTests('testCompletion_cascade', ''' | 841 buildTests('testCompletion_cascade', ''' |
| 830 class A { | 842 class A { |
| 831 aaa() {} | 843 aaa() {} |
| 832 } | 844 } |
| 833 | 845 |
| 834 | 846 |
| 835 main(A a) { | 847 main(A a) { |
| 836 a..!1 aaa(); | 848 a..!1 aaa(); |
| 837 }''', <String>["1+aaa", "1-main"]); | 849 }''', <String>["1+aaa", "1-main"]); |
| 838 | 850 |
| 839 CompletionTestCase.buildTests('testCompletion_combinator_afterComma', ''' | 851 buildTests('testCompletion_combinator_afterComma', ''' |
| 840 "import 'dart:math' show cos, !1;''', | 852 "import 'dart:math' show cos, !1;''', |
| 841 <String>["1+PI", "1+sin", "1+Random", "1-String"], | 853 <String>["1+PI", "1+sin", "1+Random", "1-String"], |
| 842 failingTests: '1'); | 854 failingTests: '1'); |
| 843 | 855 |
| 844 CompletionTestCase.buildTests('testCompletion_combinator_ended', ''' | 856 buildTests('testCompletion_combinator_ended', ''' |
| 845 import 'dart:math' show !1;"''', | 857 import 'dart:math' show !1;"''', |
| 846 <String>["1+PI", "1+sin", "1+Random", "1-String"], | 858 <String>["1+PI", "1+sin", "1+Random", "1-String"], |
| 847 failingTests: '1'); | 859 failingTests: '1'); |
| 848 | 860 |
| 849 CompletionTestCase.buildTests('testCompletion_combinator_export', ''' | 861 buildTests('testCompletion_combinator_export', ''' |
| 850 export 'dart:math' show !1;"''', | 862 export 'dart:math' show !1;"''', |
| 851 <String>["1+PI", "1+sin", "1+Random", "1-String"], | 863 <String>["1+PI", "1+sin", "1+Random", "1-String"], |
| 852 failingTests: '1'); | 864 failingTests: '1'); |
| 853 | 865 |
| 854 CompletionTestCase.buildTests('testCompletion_combinator_hide', ''' | 866 buildTests('testCompletion_combinator_hide', ''' |
| 855 import 'dart:math' hide !1;"''', | 867 import 'dart:math' hide !1;"''', |
| 856 <String>["1+PI", "1+sin", "1+Random", "1-String"], | 868 <String>["1+PI", "1+sin", "1+Random", "1-String"], |
| 857 failingTests: '1'); | 869 failingTests: '1'); |
| 858 | 870 |
| 859 CompletionTestCase.buildTests('testCompletion_combinator_notEnded', ''' | 871 buildTests('testCompletion_combinator_notEnded', ''' |
| 860 import 'dart:math' show !1"''', | 872 import 'dart:math' show !1"''', |
| 861 <String>["1+PI", "1+sin", "1+Random", "1-String"], | 873 <String>["1+PI", "1+sin", "1+Random", "1-String"], |
| 862 failingTests: '1'); | 874 failingTests: '1'); |
| 863 | 875 |
| 864 CompletionTestCase.buildTests('testCompletion_combinator_usePrefix', ''' | 876 buildTests('testCompletion_combinator_usePrefix', ''' |
| 865 import 'dart:math' show s!1"''', | 877 import 'dart:math' show s!1"''', |
| 866 <String>["1+sin", "1+sqrt", "1-cos", "1-String"], | 878 <String>["1+sin", "1+sqrt", "1-cos", "1-String"], |
| 867 failingTests: '1'); | 879 failingTests: '1'); |
| 868 | 880 |
| 869 CompletionTestCase.buildTests('testCompletion_constructor_field', ''' | 881 buildTests('testCompletion_constructor_field', ''' |
| 870 class X { X(this.field); int f!1ield;}''', | 882 class X { X(this.field); int f!1ield;}''', |
| 871 <String>["1+field"], | 883 <String>["1+field"], |
| 872 failingTests: '1'); | 884 failingTests: '1'); |
| 873 | 885 |
| 874 CompletionTestCase.buildTests( | 886 buildTests('testCompletion_constructorArguments_showOnlyCurrent', ''' |
| 875 'testCompletion_constructorArguments_showOnlyCurrent', | |
| 876 ''' | |
| 877 class A { | 887 class A { |
| 878 A.first(int p); | 888 A.first(int p); |
| 879 A.second(double p); | 889 A.second(double p); |
| 880 } | 890 } |
| 881 main() { | 891 main() { |
| 882 new A.first(!1); | 892 new A.first(!1); |
| 883 }''', <String>["1+A.first", "1-A.second"], failingTests: '1'); | 893 }''', <String>["1+A.first", "1-A.second"], failingTests: '1'); |
| 884 | 894 |
| 885 CompletionTestCase.buildTests( | 895 buildTests('testCompletion_constructorArguments_whenPrefixedType', ''' |
| 886 'testCompletion_constructorArguments_whenPrefixedType', | |
| 887 ''' | |
| 888 import 'dart:math' as m; | 896 import 'dart:math' as m; |
| 889 main() { | 897 main() { |
| 890 new m.Random(!1); | 898 new m.Random(!1); |
| 891 }''', <String>["1+Random:ARGUMENT_LIST"], failingTests: '1'); | 899 }''', <String>["1+Random:ARGUMENT_LIST"], failingTests: '1'); |
| 892 | 900 |
| 893 CompletionTestCase.buildTests( | 901 buildTests('testCompletion_dartDoc_reference_forClass', ''' |
| 894 'testCompletion_dartDoc_reference_forClass', | |
| 895 ''' | |
| 896 /** | 902 /** |
| 897 * [int!1] | 903 * [int!1] |
| 898 * [method!2] | 904 * [method!2] |
| 899 */ | 905 */ |
| 900 class AAA { | 906 class AAA { |
| 901 methodA() {} | 907 methodA() {} |
| 902 }''', <String>["1+int", "1-method", "2+methodA", "2-int"]); | 908 }''', <String>["1+int", "1-method", "2+methodA", "2-int"]); |
| 903 | 909 |
| 904 CompletionTestCase.buildTests( | 910 buildTests('testCompletion_dartDoc_reference_forConstructor', ''' |
| 905 'testCompletion_dartDoc_reference_forConstructor', | |
| 906 ''' | |
| 907 class A { | 911 class A { |
| 908 /** | 912 /** |
| 909 * [aa!1] | 913 * [aa!1] |
| 910 * [int!2] | 914 * [int!2] |
| 911 * [method!3] | 915 * [method!3] |
| 912 */ | 916 */ |
| 913 A.named(aaa, bbb) {} | 917 A.named(aaa, bbb) {} |
| 914 methodA() {} | 918 methodA() {} |
| 915 }''', | 919 }''', |
| 916 <String>["1+aaa", "1-bbb", "2+int", "2-double", "3+methodA"], | 920 <String>["1+aaa", "1-bbb", "2+int", "2-double", "3+methodA"], |
| 917 failingTests: '1'); | 921 failingTests: '1'); |
| 918 | 922 |
| 919 CompletionTestCase.buildTests( | 923 buildTests('testCompletion_dartDoc_reference_forFunction', ''' |
| 920 'testCompletion_dartDoc_reference_forFunction', | |
| 921 ''' | |
| 922 /** | 924 /** |
| 923 * [aa!1] | 925 * [aa!1] |
| 924 * [int!2] | 926 * [int!2] |
| 925 * [function!3] | 927 * [function!3] |
| 926 */ | 928 */ |
| 927 functionA(aaa, bbb) {} | 929 functionA(aaa, bbb) {} |
| 928 functionB() {}''', | 930 functionB() {}''', |
| 929 <String>[ | 931 <String>[ |
| 930 "1+aaa", | 932 "1+aaa", |
| 931 "1-bbb", | 933 "1-bbb", |
| 932 "2+int", | 934 "2+int", |
| 933 "2-double", | 935 "2-double", |
| 934 "3+functionA", | 936 "3+functionA", |
| 935 "3+functionB", | 937 "3+functionB", |
| 936 "3-int"], | 938 "3-int"], |
| 937 failingTests: '1'); | 939 failingTests: '1'); |
| 938 | 940 |
| 939 CompletionTestCase.buildTests( | 941 buildTests('testCompletion_dartDoc_reference_forFunctionTypeAlias', ''' |
| 940 'testCompletion_dartDoc_reference_forFunctionTypeAlias', | |
| 941 ''' | |
| 942 /** | 942 /** |
| 943 * [aa!1] | 943 * [aa!1] |
| 944 * [int!2] | 944 * [int!2] |
| 945 * [Function!3] | 945 * [Function!3] |
| 946 */ | 946 */ |
| 947 typedef FunctionA(aaa, bbb) {} | 947 typedef FunctionA(aaa, bbb) {} |
| 948 typedef FunctionB() {}''', | 948 typedef FunctionB() {}''', |
| 949 <String>[ | 949 <String>[ |
| 950 "1+aaa", | 950 "1+aaa", |
| 951 "1-bbb", | 951 "1-bbb", |
| 952 "2+int", | 952 "2+int", |
| 953 "2-double", | 953 "2-double", |
| 954 "3+FunctionA", | 954 "3+FunctionA", |
| 955 "3+FunctionB", | 955 "3+FunctionB", |
| 956 "3-int"], | 956 "3-int"], |
| 957 failingTests: '1'); | 957 failingTests: '1'); |
| 958 | 958 |
| 959 CompletionTestCase.buildTests( | 959 buildTests('testCompletion_dartDoc_reference_forMethod', ''' |
| 960 'testCompletion_dartDoc_reference_forMethod', | |
| 961 ''' | |
| 962 class A { | 960 class A { |
| 963 /** | 961 /** |
| 964 * [aa!1] | 962 * [aa!1] |
| 965 * [int!2] | 963 * [int!2] |
| 966 * [method!3] | 964 * [method!3] |
| 967 */ | 965 */ |
| 968 methodA(aaa, bbb) {} | 966 methodA(aaa, bbb) {} |
| 969 methodB() {} | 967 methodB() {} |
| 970 }''', | 968 }''', |
| 971 <String>[ | 969 <String>[ |
| 972 "1+aaa", | 970 "1+aaa", |
| 973 "1-bbb", | 971 "1-bbb", |
| 974 "2+int", | 972 "2+int", |
| 975 "2-double", | 973 "2-double", |
| 976 "3+methodA", | 974 "3+methodA", |
| 977 "3+methodB", | 975 "3+methodB", |
| 978 "3-int"]); | 976 "3-int"]); |
| 979 | 977 |
| 980 CompletionTestCase.buildTests( | 978 buildTests('testCompletion_dartDoc_reference_incomplete', ''' |
| 981 'testCompletion_dartDoc_reference_incomplete', | |
| 982 ''' | |
| 983 /** | 979 /** |
| 984 * [doubl!1 some text | 980 * [doubl!1 some text |
| 985 * other text | 981 * other text |
| 986 */ | 982 */ |
| 987 class A {} | 983 class A {} |
| 988 /** | 984 /** |
| 989 * [!2 some text | 985 * [!2 some text |
| 990 * other text | 986 * other text |
| 991 */ | 987 */ |
| 992 class B {} | 988 class B {} |
| 993 /** | 989 /** |
| 994 * [!3] some text | 990 * [!3] some text |
| 995 */ | 991 */ |
| 996 class C {}''', | 992 class C {}''', |
| 997 <String>["1+double", "1-int", "2+int", "2+String", "3+int", "3+String"])
; | 993 <String>["1+double", "1-int", "2+int", "2+String", "3+int", "3+String"])
; |
| 998 | 994 |
| 999 CompletionTestCase.buildTests('testCompletion_double_inFractionPart', ''' | 995 buildTests('testCompletion_double_inFractionPart', ''' |
| 1000 main() { | 996 main() { |
| 1001 1.0!1 | 997 1.0!1 |
| 1002 }''', <String>["1-abs", "1-main"], failingTests: '1'); | 998 }''', <String>["1-abs", "1-main"], failingTests: '1'); |
| 1003 | 999 |
| 1004 CompletionTestCase.buildTests('testCompletion_enum', ''' | 1000 buildTests('testCompletion_enum', ''' |
| 1005 enum MyEnum {A, B, C} | 1001 enum MyEnum {A, B, C} |
| 1006 main() { | 1002 main() { |
| 1007 MyEnum.!1; | 1003 MyEnum.!1; |
| 1008 }''', <String>["1+values", "1+A", "1+B", "1+C"], failingTests: '1'); | 1004 }''', <String>["1+values", "1+A", "1+B", "1+C"], failingTests: '1'); |
| 1009 | 1005 |
| 1010 CompletionTestCase.buildTests( | 1006 buildTests('testCompletion_exactPrefix_hasHigherRelevance', ''' |
| 1011 'testCompletion_exactPrefix_hasHigherRelevance', | |
| 1012 ''' | |
| 1013 var STR; | 1007 var STR; |
| 1014 main(p) { | 1008 main(p) { |
| 1015 var str; | 1009 var str; |
| 1016 str!1; | 1010 str!1; |
| 1017 STR!2; | 1011 STR!2; |
| 1018 Str!3; | 1012 Str!3; |
| 1019 }''', | 1013 }''', |
| 1020 <String>[ | 1014 <String>[ |
| 1021 "1+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, | 1015 "1+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, |
| 1022 "1+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, | 1016 "1+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, |
| 1023 "2+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, | 1017 "2+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, |
| 1024 "2+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, | 1018 "2+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, |
| 1025 "3+String" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, | 1019 "3+String" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, |
| 1026 "3+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, | 1020 "3+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, |
| 1027 "3+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/]); | 1021 "3+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/]); |
| 1028 | 1022 |
| 1029 CompletionTestCase.buildTests('testCompletion_export_dart', ''' | 1023 buildTests('testCompletion_export_dart', ''' |
| 1030 import 'dart:math | 1024 import 'dart:math |
| 1031 import 'dart:_chrome | 1025 import 'dart:_chrome |
| 1032 import 'dart:_collection.dev | 1026 import 'dart:_collection.dev |
| 1033 export 'dart:!1''', | 1027 export 'dart:!1''', |
| 1034 <String>[ | 1028 <String>[ |
| 1035 "1+dart:core", | 1029 "1+dart:core", |
| 1036 "1+dart:math", | 1030 "1+dart:math", |
| 1037 "1-dart:_chrome", | 1031 "1-dart:_chrome", |
| 1038 "1-dart:_collection.dev"], | 1032 "1-dart:_collection.dev"], |
| 1039 failingTests: '1'); | 1033 failingTests: '1'); |
| 1040 | 1034 |
| 1041 CompletionTestCase.buildTests( | 1035 buildTests('testCompletion_export_noStringLiteral_noSemicolon', ''' |
| 1042 'testCompletion_export_noStringLiteral_noSemicolon', | |
| 1043 ''' | |
| 1044 import !1 | 1036 import !1 |
| 1045 | 1037 |
| 1046 class A {}''', <String>["1+'dart:!';", "1+'package:!';"], failingTests: '1'); | 1038 class A {}''', <String>["1+'dart:!';", "1+'package:!';"], failingTests: '1'); |
| 1047 | 1039 |
| 1048 CompletionTestCase.buildTests('testCompletion_forStmt_vars', ''' | 1040 buildTests('testCompletion_forStmt_vars', ''' |
| 1049 class int{}class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}''', | 1041 class int{}class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}''', |
| 1050 <String>["1+int", "2+i", "3+i"], | 1042 <String>["1+int", "2+i", "3+i"], |
| 1051 failingTests: '1'); | 1043 failingTests: '1'); |
| 1052 | 1044 |
| 1053 CompletionTestCase.buildTests('testCompletion_function', ''' | 1045 buildTests('testCompletion_function', ''' |
| 1054 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b));
}}''', | 1046 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b));
}}''', |
| 1055 <String>["1+String"]); | 1047 <String>["1+String"]); |
| 1056 | 1048 |
| 1057 CompletionTestCase.buildTests('testCompletion_function_partial', ''' | 1049 buildTests('testCompletion_function_partial', ''' |
| 1058 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}''', | 1050 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}''', |
| 1059 <String>["1+String"]); | 1051 <String>["1+String"]); |
| 1060 | 1052 |
| 1061 CompletionTestCase.buildTests( | 1053 buildTests('testCompletion_functionTypeParameter_namedArgument', ''' |
| 1062 'testCompletion_functionTypeParameter_namedArgument', | |
| 1063 ''' | |
| 1064 typedef FFF(a, b, {x1, x2, y}); | 1054 typedef FFF(a, b, {x1, x2, y}); |
| 1065 main(FFF fff) { | 1055 main(FFF fff) { |
| 1066 fff(1, 2, !1)!2; | 1056 fff(1, 2, !1)!2; |
| 1067 }''', <String>["1+x1", "2-x2"], failingTests: '1'); | 1057 }''', <String>["1+x1", "2-x2"], failingTests: '1'); |
| 1068 | 1058 |
| 1069 CompletionTestCase.buildTests('testCompletion_ifStmt_field1', ''' | 1059 buildTests('testCompletion_ifStmt_field1', ''' |
| 1070 class Foo { int myField = 7; mth() { if (!1) {}}}''', <String>["1+myField"]); | 1060 class Foo { int myField = 7; mth() { if (!1) {}}}''', <String>["1+myField"]); |
| 1071 | 1061 |
| 1072 CompletionTestCase.buildTests('testCompletion_ifStmt_field1a', ''' | 1062 buildTests('testCompletion_ifStmt_field1a', ''' |
| 1073 class Foo { int myField = 7; mth() { if (!1) }}''', <String>["1+myField"]); | 1063 class Foo { int myField = 7; mth() { if (!1) }}''', <String>["1+myField"]); |
| 1074 | 1064 |
| 1075 CompletionTestCase.buildTests('testCompletion_ifStmt_field2', ''' | 1065 buildTests('testCompletion_ifStmt_field2', ''' |
| 1076 class Foo { int myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]); | 1066 class Foo { int myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]); |
| 1077 | 1067 |
| 1078 CompletionTestCase.buildTests('testCompletion_ifStmt_field2a', ''' | 1068 buildTests('testCompletion_ifStmt_field2a', ''' |
| 1079 class Foo { int myField = 7; mth() { if (m!1) }}''', <String>["1+myField"]); | 1069 class Foo { int myField = 7; mth() { if (m!1) }}''', <String>["1+myField"]); |
| 1080 | 1070 |
| 1081 CompletionTestCase.buildTests('testCompletion_ifStmt_field2b', ''' | 1071 buildTests('testCompletion_ifStmt_field2b', ''' |
| 1082 class Foo { myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]); | 1072 class Foo { myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]); |
| 1083 | 1073 |
| 1084 CompletionTestCase.buildTests('testCompletion_ifStmt_localVar', ''' | 1074 buildTests('testCompletion_ifStmt_localVar', ''' |
| 1085 class Foo { mth() { int value = 7; if (v!1) {}}}''', <String>["1+value"]); | 1075 class Foo { mth() { int value = 7; if (v!1) {}}}''', <String>["1+value"]); |
| 1086 | 1076 |
| 1087 CompletionTestCase.buildTests('testCompletion_ifStmt_localVara', ''' | 1077 buildTests('testCompletion_ifStmt_localVara', ''' |
| 1088 class Foo { mth() { value = 7; if (v!1) {}}}''', <String>["1-value"]); | 1078 class Foo { mth() { value = 7; if (v!1) {}}}''', <String>["1-value"]); |
| 1089 | 1079 |
| 1090 CompletionTestCase.buildTests('testCompletion_ifStmt_topLevelVar', ''' | 1080 buildTests('testCompletion_ifStmt_topLevelVar', ''' |
| 1091 int topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]); | 1081 int topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]); |
| 1092 | 1082 |
| 1093 CompletionTestCase.buildTests('testCompletion_ifStmt_topLevelVara', ''' | 1083 buildTests('testCompletion_ifStmt_topLevelVara', ''' |
| 1094 topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]); | 1084 topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]); |
| 1095 | 1085 |
| 1096 CompletionTestCase.buildTests( | 1086 buildTests('testCompletion_ifStmt_unionType_nonStrict', ''' |
| 1097 'testCompletion_ifStmt_unionType_nonStrict', | |
| 1098 ''' | |
| 1099 class A { a() => null; x() => null} | 1087 class A { a() => null; x() => null} |
| 1100 class B { a() => null; y() => null} | 1088 class B { a() => null; y() => null} |
| 1101 void main() { | 1089 void main() { |
| 1102 var x; | 1090 var x; |
| 1103 var c; | 1091 var c; |
| 1104 if(c) { | 1092 if(c) { |
| 1105 x = new A(); | 1093 x = new A(); |
| 1106 } else { | 1094 } else { |
| 1107 x = new B(); | 1095 x = new B(); |
| 1108 } | 1096 } |
| 1109 x.!1; | 1097 x.!1; |
| 1110 }''', <String>["1+a", "1+x", "1+y"], failingTests: '1'); | 1098 }''', <String>["1+a", "1+x", "1+y"], failingTests: '1'); |
| 1111 | 1099 |
| 1112 CompletionTestCase.buildTests('testCompletion_ifStmt_unionType_strict', ''' | 1100 buildTests('testCompletion_ifStmt_unionType_strict', ''' |
| 1113 class A { a() => null; x() => null} | 1101 class A { a() => null; x() => null} |
| 1114 class B { a() => null; y() => null} | 1102 class B { a() => null; y() => null} |
| 1115 void main() { | 1103 void main() { |
| 1116 var x; | 1104 var x; |
| 1117 var c; | 1105 var c; |
| 1118 if(c) { | 1106 if(c) { |
| 1119 x = new A(); | 1107 x = new A(); |
| 1120 } else { | 1108 } else { |
| 1121 x = new B(); | 1109 x = new B(); |
| 1122 } | 1110 } |
| 1123 x.!1; | 1111 x.!1; |
| 1124 }''', <String>["1+a", "1-x", "1-y"], failingTests: '1'); | 1112 }''', <String>["1+a", "1-x", "1-y"], failingTests: '1'); |
| 1125 | 1113 |
| 1126 CompletionTestCase.buildTests('testCompletion_import', ''' | 1114 buildTests('testCompletion_import', ''' |
| 1127 import '!1';''', <String>["1+dart:!", "1+package:!"], failingTests: '1'); | 1115 import '!1';''', <String>["1+dart:!", "1+package:!"], failingTests: '1'); |
| 1128 | 1116 |
| 1129 CompletionTestCase.buildTests('testCompletion_import_dart', ''' | 1117 buildTests('testCompletion_import_dart', ''' |
| 1130 import 'dart:math | 1118 import 'dart:math |
| 1131 import 'dart:_chrome | 1119 import 'dart:_chrome |
| 1132 import 'dart:_collection.dev | 1120 import 'dart:_collection.dev |
| 1133 import 'dart:!1''', | 1121 import 'dart:!1''', |
| 1134 <String>[ | 1122 <String>[ |
| 1135 "1+dart:core", | 1123 "1+dart:core", |
| 1136 "1+dart:math", | 1124 "1+dart:math", |
| 1137 "1-dart:_chrome", | 1125 "1-dart:_chrome", |
| 1138 "1-dart:_collection.dev"], | 1126 "1-dart:_collection.dev"], |
| 1139 failingTests: '1'); | 1127 failingTests: '1'); |
| 1140 | 1128 |
| 1141 CompletionTestCase.buildTests( | 1129 buildTests('testCompletion_import_hasStringLiteral_noSemicolon', ''' |
| 1142 'testCompletion_import_hasStringLiteral_noSemicolon', | |
| 1143 ''' | |
| 1144 import '!1' | 1130 import '!1' |
| 1145 | 1131 |
| 1146 class A {}''', <String>["1+dart:!", "1+package:!"], failingTests: '1'); | 1132 class A {}''', <String>["1+dart:!", "1+package:!"], failingTests: '1'); |
| 1147 | 1133 |
| 1148 CompletionTestCase.buildTests('testCompletion_import_noSpace', ''' | 1134 buildTests('testCompletion_import_noSpace', ''' |
| 1149 import!1''', <String>["1+ 'dart:!';", "1+ 'package:!';"], failingTests: '1'); | 1135 import!1''', <String>["1+ 'dart:!';", "1+ 'package:!';"], failingTests: '1'); |
| 1150 | 1136 |
| 1151 CompletionTestCase.buildTests('testCompletion_import_noStringLiteral', ''' | 1137 buildTests('testCompletion_import_noStringLiteral', ''' |
| 1152 import !1;''', <String>["1+'dart:!'", "1+'package:!'"], failingTests: '1'); | 1138 import !1;''', <String>["1+'dart:!'", "1+'package:!'"], failingTests: '1'); |
| 1153 | 1139 |
| 1154 CompletionTestCase.buildTests( | 1140 buildTests('testCompletion_import_noStringLiteral_noSemicolon', ''' |
| 1155 'testCompletion_import_noStringLiteral_noSemicolon', | |
| 1156 ''' | |
| 1157 import !1 | 1141 import !1 |
| 1158 | 1142 |
| 1159 class A {}''', <String>["1+'dart:!';", "1+'package:!';"], failingTests: '1'); | 1143 class A {}''', <String>["1+'dart:!';", "1+'package:!';"], failingTests: '1'); |
| 1160 | 1144 |
| 1161 CompletionTestCase.buildTests('testCompletion_incompleteClassMember', ''' | 1145 buildTests('testCompletion_incompleteClassMember', ''' |
| 1162 class A { | 1146 class A { |
| 1163 Str!1 | 1147 Str!1 |
| 1164 final f = null; | 1148 final f = null; |
| 1165 }''', <String>["1+String", "1-bool"]); | 1149 }''', <String>["1+String", "1-bool"]); |
| 1166 | 1150 |
| 1167 CompletionTestCase.buildTests( | 1151 buildTests('testCompletion_incompleteClosure_parameterType', ''' |
| 1168 'testCompletion_incompleteClosure_parameterType', | |
| 1169 ''' | |
| 1170 f1(cb(String s)) {} | 1152 f1(cb(String s)) {} |
| 1171 f2(String s) {} | 1153 f2(String s) {} |
| 1172 main() { | 1154 main() { |
| 1173 f1((Str!1)); | 1155 f1((Str!1)); |
| 1174 f2((Str!2)); | 1156 f2((Str!2)); |
| 1175 }''', <String>["1+String", "1-bool", "2+String", "2-bool"]); | 1157 }''', <String>["1+String", "1-bool", "2+String", "2-bool"]); |
| 1176 | 1158 |
| 1177 CompletionTestCase.buildTests('testCompletion_inPeriodPeriod', ''' | 1159 buildTests('testCompletion_inPeriodPeriod', ''' |
| 1178 main(String str) { | 1160 main(String str) { |
| 1179 1 < str.!1.length; | 1161 1 < str.!1.length; |
| 1180 1 + str.!2.length; | 1162 1 + str.!2.length; |
| 1181 1 + 2 * str.!3.length; | 1163 1 + 2 * str.!3.length; |
| 1182 }''', | 1164 }''', |
| 1183 <String>["1+codeUnits", "2+codeUnits", "3+codeUnits"], | 1165 <String>["1+codeUnits", "2+codeUnits", "3+codeUnits"], |
| 1184 failingTests: '123'); | 1166 failingTests: '123'); |
| 1185 | 1167 |
| 1186 // no checks, but no exceptions | 1168 // no checks, but no exceptions |
| 1187 CompletionTestCase.buildTests( | 1169 buildTests('testCompletion_instanceCreation_unresolved', ''' |
| 1188 'testCompletion_instanceCreation_unresolved', | |
| 1189 ''' | |
| 1190 class A { | 1170 class A { |
| 1191 } | 1171 } |
| 1192 main() { | 1172 main() { |
| 1193 new NoSuchClass(!1); | 1173 new NoSuchClass(!1); |
| 1194 new A.noSuchConstructor(!2); | 1174 new A.noSuchConstructor(!2); |
| 1195 }''', <String>["1+int", "2+int"]); | 1175 }''', <String>["1+int", "2+int"]); |
| 1196 | 1176 |
| 1197 CompletionTestCase.buildTests('testCompletion_import_lib', ''' | 1177 buildTests('testCompletion_import_lib', ''' |
| 1198 import '!1''', <String>["1+my_lib.dart"], extraFiles: <String, String>{ | 1178 import '!1''', <String>["1+my_lib.dart"], extraFiles: <String, String>{ |
| 1199 "/my_lib.dart": "" | 1179 "/my_lib.dart": "" |
| 1200 }, failingTests: '1'); | 1180 }, failingTests: '1'); |
| 1201 | 1181 |
| 1202 CompletionTestCase.buildTests('testCompletion_is', ''' | 1182 buildTests('testCompletion_is', ''' |
| 1203 class MyClass {} | 1183 class MyClass {} |
| 1204 main(p) { | 1184 main(p) { |
| 1205 var isVariable; | 1185 var isVariable; |
| 1206 if (p is MyCla!1) {} | 1186 if (p is MyCla!1) {} |
| 1207 var v1 = p is MyCla!2; | 1187 var v1 = p is MyCla!2; |
| 1208 var v2 = p is !3; | 1188 var v2 = p is !3; |
| 1209 var v2 = p is!4; | 1189 var v2 = p is!4; |
| 1210 }''', | 1190 }''', |
| 1211 <String>["1+MyClass", "2+MyClass", "3+MyClass", "3-v1", "4+is", "4-isVar
iable"], | 1191 <String>["1+MyClass", "2+MyClass", "3+MyClass", "3-v1", "4+is", "4-isVar
iable"], |
| 1212 failingTests: '4'); | 1192 failingTests: '4'); |
| 1213 | 1193 |
| 1214 CompletionTestCase.buildTests('testCompletion_is_asIdentifierStart', ''' | 1194 buildTests('testCompletion_is_asIdentifierStart', ''' |
| 1215 main(p) { | 1195 main(p) { |
| 1216 var isVisible; | 1196 var isVisible; |
| 1217 var v1 = is!1; | 1197 var v1 = is!1; |
| 1218 var v2 = is!2 | 1198 var v2 = is!2 |
| 1219 }''', <String>["1+isVisible", "2+isVisible"]); | 1199 }''', <String>["1+isVisible", "2+isVisible"]); |
| 1220 | 1200 |
| 1221 CompletionTestCase.buildTests( | 1201 buildTests('testCompletion_is_asPrefixedIdentifierStart', ''' |
| 1222 'testCompletion_is_asPrefixedIdentifierStart', | |
| 1223 ''' | |
| 1224 class A { | 1202 class A { |
| 1225 var isVisible; | 1203 var isVisible; |
| 1226 } | 1204 } |
| 1227 | 1205 |
| 1228 main(A p) { | 1206 main(A p) { |
| 1229 var v1 = p.is!1; | 1207 var v1 = p.is!1; |
| 1230 var v2 = p.is!2 | 1208 var v2 = p.is!2 |
| 1231 }''', <String>["1+isVisible", "2+isVisible"]); | 1209 }''', <String>["1+isVisible", "2+isVisible"]); |
| 1232 | 1210 |
| 1233 CompletionTestCase.buildTests('testCompletion_is_incompleteStatement1', ''' | 1211 buildTests('testCompletion_is_incompleteStatement1', ''' |
| 1234 class MyClass {} | 1212 class MyClass {} |
| 1235 main(p) { | 1213 main(p) { |
| 1236 var justSomeVar; | 1214 var justSomeVar; |
| 1237 var v = p is !1 | 1215 var v = p is !1 |
| 1238 }''', <String>["1+MyClass", "1-justSomeVar"], failingTests: '1'); | 1216 }''', <String>["1+MyClass", "1-justSomeVar"], failingTests: '1'); |
| 1239 | 1217 |
| 1240 CompletionTestCase.buildTests('testCompletion_is_incompleteStatement2', ''' | 1218 buildTests('testCompletion_is_incompleteStatement2', ''' |
| 1241 class MyClass {} | 1219 class MyClass {} |
| 1242 main(p) { | 1220 main(p) { |
| 1243 var isVariable; | 1221 var isVariable; |
| 1244 var v = p is!1 | 1222 var v = p is!1 |
| 1245 }''', <String>["1+is", "1-isVariable"], failingTests: '1'); | 1223 }''', <String>["1+is", "1-isVariable"], failingTests: '1'); |
| 1246 | 1224 |
| 1247 CompletionTestCase.buildTests('testCompletion_keyword_in', ''' | 1225 buildTests('testCompletion_keyword_in', ''' |
| 1248 class Foo { int input = 7; mth() { if (in!1) {}}}''', <String>["1+input"]); | 1226 class Foo { int input = 7; mth() { if (in!1) {}}}''', <String>["1+input"]); |
| 1249 | 1227 |
| 1250 CompletionTestCase.buildTests( | 1228 buildTests('testCompletion_keyword_syntheticIdentifier', ''' |
| 1251 'testCompletion_keyword_syntheticIdentifier', | |
| 1252 ''' | |
| 1253 main() { | 1229 main() { |
| 1254 var caseVar; | 1230 var caseVar; |
| 1255 var otherVar; | 1231 var otherVar; |
| 1256 var v = case!1 | 1232 var v = case!1 |
| 1257 }''', <String>["1+caseVar", "1-otherVar"]); | 1233 }''', <String>["1+caseVar", "1-otherVar"]); |
| 1258 | 1234 |
| 1259 CompletionTestCase.buildTests('testCompletion_libraryIdentifier_atEOF', ''' | 1235 buildTests('testCompletion_libraryIdentifier_atEOF', ''' |
| 1260 library int.!1''', <String>["1-parse", "1-bool"], failingTests: '1'); | 1236 library int.!1''', <String>["1-parse", "1-bool"], failingTests: '1'); |
| 1261 | 1237 |
| 1262 CompletionTestCase.buildTests('testCompletion_libraryIdentifier_notEOF', ''' | 1238 buildTests('testCompletion_libraryIdentifier_notEOF', ''' |
| 1263 library int.!1''', <String>["1-parse", "1-bool"], failingTests: '1'); | 1239 library int.!1''', <String>["1-parse", "1-bool"], failingTests: '1'); |
| 1264 | 1240 |
| 1265 CompletionTestCase.buildTests( | 1241 buildTests('testCompletion_methodRef_asArg_incompatibleFunctionType', ''' |
| 1266 'testCompletion_methodRef_asArg_incompatibleFunctionType', | |
| 1267 ''' | |
| 1268 foo( f(int p) ) {} | 1242 foo( f(int p) ) {} |
| 1269 class Functions { | 1243 class Functions { |
| 1270 static myFuncInt(int p) {} | 1244 static myFuncInt(int p) {} |
| 1271 static myFuncDouble(double p) {} | 1245 static myFuncDouble(double p) {} |
| 1272 } | 1246 } |
| 1273 bar(p) {} | 1247 bar(p) {} |
| 1274 main(p) { | 1248 main(p) { |
| 1275 foo( Functions.!1; ); | 1249 foo( Functions.!1; ); |
| 1276 }''', | 1250 }''', |
| 1277 <String>[ | 1251 <String>[ |
| 1278 "1+myFuncInt" /*":" + ProposalKind.METHOD_NAME*/, | 1252 "1+myFuncInt" /*":" + ProposalKind.METHOD_NAME*/, |
| 1279 "1-myFuncDouble" /*":" + ProposalKind.METHOD_NAME*/], | 1253 "1-myFuncDouble" /*":" + ProposalKind.METHOD_NAME*/], |
| 1280 failingTests: '1'); | 1254 failingTests: '1'); |
| 1281 | 1255 |
| 1282 CompletionTestCase.buildTests( | 1256 buildTests('testCompletion_methodRef_asArg_notFunctionType', ''' |
| 1283 'testCompletion_methodRef_asArg_notFunctionType', | |
| 1284 ''' | |
| 1285 foo( f(int p) ) {} | 1257 foo( f(int p) ) {} |
| 1286 class Functions { | 1258 class Functions { |
| 1287 static myFunc(int p) {} | 1259 static myFunc(int p) {} |
| 1288 } | 1260 } |
| 1289 bar(p) {} | 1261 bar(p) {} |
| 1290 main(p) { | 1262 main(p) { |
| 1291 foo( (int p) => Functions.!1; ); | 1263 foo( (int p) => Functions.!1; ); |
| 1292 }''', | 1264 }''', |
| 1293 <String>[ | 1265 <String>[ |
| 1294 "1+myFunc" /*":" + ProposalKind.METHOD*/, | 1266 "1+myFunc" /*":" + ProposalKind.METHOD*/, |
| 1295 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/], | 1267 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/], |
| 1296 failingTests: '1'); | 1268 failingTests: '1'); |
| 1297 | 1269 |
| 1298 CompletionTestCase.buildTests( | 1270 buildTests('testCompletion_methodRef_asArg_ofFunctionType', ''' |
| 1299 'testCompletion_methodRef_asArg_ofFunctionType', | |
| 1300 ''' | |
| 1301 foo( f(int p) ) {} | 1271 foo( f(int p) ) {} |
| 1302 class Functions { | 1272 class Functions { |
| 1303 static int myFunc(int p) {} | 1273 static int myFunc(int p) {} |
| 1304 } | 1274 } |
| 1305 main(p) { | 1275 main(p) { |
| 1306 foo(Functions.!1); | 1276 foo(Functions.!1); |
| 1307 }''', | 1277 }''', |
| 1308 <String>[ | 1278 <String>[ |
| 1309 "1+myFunc" /*":" + ProposalKind.METHOD*/, | 1279 "1+myFunc" /*":" + ProposalKind.METHOD*/, |
| 1310 "1+myFunc" /*":" + ProposalKind.METHOD_NAME*/]); | 1280 "1+myFunc" /*":" + ProposalKind.METHOD_NAME*/]); |
| 1311 | 1281 |
| 1312 CompletionTestCase.buildTests( | 1282 buildTests('testCompletion_namedArgument_alreadyUsed', ''' |
| 1313 'testCompletion_namedArgument_alreadyUsed', | |
| 1314 ''' | |
| 1315 func({foo}) {} main() { func(foo: 0, fo!1); }''', <String>["1-foo"]); | 1283 func({foo}) {} main() { func(foo: 0, fo!1); }''', <String>["1-foo"]); |
| 1316 | 1284 |
| 1317 CompletionTestCase.buildTests( | 1285 buildTests('testCompletion_namedArgument_constructor', ''' |
| 1318 'testCompletion_namedArgument_constructor', | |
| 1319 ''' | |
| 1320 class A {A({foo, bar}) {}} main() { new A(fo!1); }''', | 1286 class A {A({foo, bar}) {}} main() { new A(fo!1); }''', |
| 1321 <String>["1+foo", "1-bar"], | 1287 <String>["1+foo", "1-bar"], |
| 1322 failingTests: '1'); | 1288 failingTests: '1'); |
| 1323 | 1289 |
| 1324 CompletionTestCase.buildTests('testCompletion_namedArgument_empty', ''' | 1290 buildTests('testCompletion_namedArgument_empty', ''' |
| 1325 func({foo, bar}) {} main() { func(!1); }''', | 1291 func({foo, bar}) {} main() { func(!1); }''', |
| 1326 <String>[ | 1292 <String>[ |
| 1327 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/, | 1293 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/, |
| 1328 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/], | 1294 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/], |
| 1329 failingTests: '1'); | 1295 failingTests: '1'); |
| 1330 | 1296 |
| 1331 CompletionTestCase.buildTests('testCompletion_namedArgument_function', ''' | 1297 buildTests('testCompletion_namedArgument_function', ''' |
| 1332 func({foo, bar}) {} main() { func(fo!1); }''', | 1298 func({foo, bar}) {} main() { func(fo!1); }''', |
| 1333 <String>["1+foo", "1-bar"], | 1299 <String>["1+foo", "1-bar"], |
| 1334 failingTests: '1'); | 1300 failingTests: '1'); |
| 1335 | 1301 |
| 1336 CompletionTestCase.buildTests('testCompletion_namedArgument_notNamed', ''' | 1302 buildTests('testCompletion_namedArgument_notNamed', ''' |
| 1337 func([foo]) {} main() { func(fo!1); }''', <String>["1-foo"]); | 1303 func([foo]) {} main() { func(fo!1); }''', <String>["1-foo"]); |
| 1338 | 1304 |
| 1339 CompletionTestCase.buildTests( | 1305 buildTests('testCompletion_namedArgument_unresolvedFunction', ''' |
| 1340 'testCompletion_namedArgument_unresolvedFunction', | |
| 1341 ''' | |
| 1342 main() { func(fo!1); }''', <String>["1-foo"]); | 1306 main() { func(fo!1); }''', <String>["1-foo"]); |
| 1343 | 1307 |
| 1344 CompletionTestCase.buildTests('testCompletion_newMemberType1', ''' | 1308 buildTests('testCompletion_newMemberType1', ''' |
| 1345 class Collection{}class List extends Collection{}class Foo { !1 }''', | 1309 class Collection{}class List extends Collection{}class Foo { !1 }''', |
| 1346 <String>["1+Collection", "1+List"], | 1310 <String>["1+Collection", "1+List"], |
| 1347 failingTests: '1'); | 1311 failingTests: '1'); |
| 1348 | 1312 |
| 1349 CompletionTestCase.buildTests('testCompletion_newMemberType2', ''' | 1313 buildTests('testCompletion_newMemberType2', ''' |
| 1350 class Collection{}class List extends Collection{}class Foo {!1}''', | 1314 class Collection{}class List extends Collection{}class Foo {!1}''', |
| 1351 <String>["1+Collection", "1+List"], | 1315 <String>["1+Collection", "1+List"], |
| 1352 failingTests: '1'); | 1316 failingTests: '1'); |
| 1353 | 1317 |
| 1354 CompletionTestCase.buildTests('testCompletion_newMemberType3', ''' | 1318 buildTests('testCompletion_newMemberType3', ''' |
| 1355 class Collection{}class List extends Collection{}class Foo {L!1}''', | 1319 class Collection{}class List extends Collection{}class Foo {L!1}''', |
| 1356 <String>["1-Collection", "1+List"], | 1320 <String>["1-Collection", "1+List"], |
| 1357 failingTests: '1'); | 1321 failingTests: '1'); |
| 1358 | 1322 |
| 1359 CompletionTestCase.buildTests('testCompletion_newMemberType4', ''' | 1323 buildTests('testCompletion_newMemberType4', ''' |
| 1360 class Collection{}class List extends Collection{}class Foo {C!1}''', | 1324 class Collection{}class List extends Collection{}class Foo {C!1}''', |
| 1361 <String>["1+Collection", "1-List"]); | 1325 <String>["1+Collection", "1-List"]); |
| 1362 | 1326 |
| 1363 CompletionTestCase.buildTests( | 1327 buildTests('testCompletion_positionalArgument_constructor', ''' |
| 1364 'testCompletion_positionalArgument_constructor', | |
| 1365 ''' | |
| 1366 class A { | 1328 class A { |
| 1367 A([foo, bar]); | 1329 A([foo, bar]); |
| 1368 } | 1330 } |
| 1369 main() { | 1331 main() { |
| 1370 new A(!1); | 1332 new A(!1); |
| 1371 new A(0, !2); | 1333 new A(0, !2); |
| 1372 }''', | 1334 }''', |
| 1373 <String>[ | 1335 <String>[ |
| 1374 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, | 1336 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, |
| 1375 "1-bar", | 1337 "1-bar", |
| 1376 "2-foo", | 1338 "2-foo", |
| 1377 "2+bar" /*":" | 1339 "2+bar" /*":" |
| 1378 + ProposalKind.OPTIONAL_ARGUMENT*/], failingTests: '12'); | 1340 + ProposalKind.OPTIONAL_ARGUMENT*/], failingTests: '12'); |
| 1379 | 1341 |
| 1380 CompletionTestCase.buildTests( | 1342 buildTests('testCompletion_positionalArgument_function', ''' |
| 1381 'testCompletion_positionalArgument_function', | |
| 1382 ''' | |
| 1383 func([foo, bar]) {} | 1343 func([foo, bar]) {} |
| 1384 main() { | 1344 main() { |
| 1385 func(!1); | 1345 func(!1); |
| 1386 func(0, !2); | 1346 func(0, !2); |
| 1387 }''', | 1347 }''', |
| 1388 <String>[ | 1348 <String>[ |
| 1389 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, | 1349 "1+foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/, |
| 1390 "1-bar", | 1350 "1-bar", |
| 1391 "2-foo", | 1351 "2-foo", |
| 1392 "2+bar" /*":" | 1352 "2+bar" /*":" |
| 1393 + ProposalKind.OPTIONAL_ARGUMENT*/], failingTests: '12'); | 1353 + ProposalKind.OPTIONAL_ARGUMENT*/], failingTests: '12'); |
| 1394 | 1354 |
| 1395 CompletionTestCase.buildTests('testCompletion_preferStaticType', ''' | 1355 buildTests('testCompletion_preferStaticType', ''' |
| 1396 class A { | 1356 class A { |
| 1397 foo() {} | 1357 foo() {} |
| 1398 } | 1358 } |
| 1399 class B extends A { | 1359 class B extends A { |
| 1400 bar() {} | 1360 bar() {} |
| 1401 } | 1361 } |
| 1402 main() { | 1362 main() { |
| 1403 A v = new B(); | 1363 A v = new B(); |
| 1404 v.!1 | 1364 v.!1 |
| 1405 }''', | 1365 }''', |
| 1406 <String>[ | 1366 <String>[ |
| 1407 "1+foo", | 1367 "1+foo", |
| 1408 "1-bar,potential=false,declaringType=B", | 1368 "1-bar,potential=false,declaringType=B", |
| 1409 "1+bar,potential=true,declaringType=B"], | 1369 "1+bar,potential=true,declaringType=B"], |
| 1410 failingTests: '1'); | 1370 failingTests: '1'); |
| 1411 | 1371 |
| 1412 CompletionTestCase.buildTests( | 1372 buildTests('testCompletion_privateElement_sameLibrary_constructor', ''' |
| 1413 'testCompletion_privateElement_sameLibrary_constructor', | |
| 1414 ''' | |
| 1415 class A { | 1373 class A { |
| 1416 A._c(); | 1374 A._c(); |
| 1417 A.c(); | 1375 A.c(); |
| 1418 } | 1376 } |
| 1419 main() { | 1377 main() { |
| 1420 new A.!1 | 1378 new A.!1 |
| 1421 }''', <String>["1+_c", "1+c"]); | 1379 }''', <String>["1+_c", "1+c"]); |
| 1422 | 1380 |
| 1423 CompletionTestCase.buildTests( | 1381 buildTests('testCompletion_privateElement_sameLibrary_member', ''' |
| 1424 'testCompletion_privateElement_sameLibrary_member', | |
| 1425 ''' | |
| 1426 class A { | 1382 class A { |
| 1427 _m() {} | 1383 _m() {} |
| 1428 m() {} | 1384 m() {} |
| 1429 } | 1385 } |
| 1430 main(A a) { | 1386 main(A a) { |
| 1431 a.!1 | 1387 a.!1 |
| 1432 }''', <String>["1+_m", "1+m"]); | 1388 }''', <String>["1+_m", "1+m"]); |
| 1433 | 1389 |
| 1434 CompletionTestCase.buildTests( | 1390 buildTests('testCompletion_propertyAccess_whenClassTarget', ''' |
| 1435 'testCompletion_propertyAccess_whenClassTarget', | |
| 1436 ''' | |
| 1437 class A { | 1391 class A { |
| 1438 static int FIELD; | 1392 static int FIELD; |
| 1439 int field; | 1393 int field; |
| 1440 } | 1394 } |
| 1441 main() { | 1395 main() { |
| 1442 A.!1 | 1396 A.!1 |
| 1443 }''', <String>["1+FIELD", "1-field"]); | 1397 }''', <String>["1+FIELD", "1-field"]); |
| 1444 | 1398 |
| 1445 CompletionTestCase.buildTests( | 1399 buildTests('testCompletion_propertyAccess_whenClassTarget_excludeSuper', ''' |
| 1446 'testCompletion_propertyAccess_whenClassTarget_excludeSuper', | |
| 1447 ''' | |
| 1448 class A { | 1400 class A { |
| 1449 static int FIELD_A; | 1401 static int FIELD_A; |
| 1450 static int methodA() {} | 1402 static int methodA() {} |
| 1451 } | 1403 } |
| 1452 class B extends A { | 1404 class B extends A { |
| 1453 static int FIELD_B; | 1405 static int FIELD_B; |
| 1454 static int methodB() {} | 1406 static int methodB() {} |
| 1455 } | 1407 } |
| 1456 main() { | 1408 main() { |
| 1457 B.!1; | 1409 B.!1; |
| 1458 }''', | 1410 }''', |
| 1459 <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"], | 1411 <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"], |
| 1460 failingTests: '1'); | 1412 failingTests: '1'); |
| 1461 | 1413 |
| 1462 CompletionTestCase.buildTests( | 1414 buildTests('testCompletion_propertyAccess_whenInstanceTarget', ''' |
| 1463 'testCompletion_propertyAccess_whenInstanceTarget', | |
| 1464 ''' | |
| 1465 class A { | 1415 class A { |
| 1466 static int FIELD; | 1416 static int FIELD; |
| 1467 int fieldA; | 1417 int fieldA; |
| 1468 } | 1418 } |
| 1469 class B { | 1419 class B { |
| 1470 A a; | 1420 A a; |
| 1471 } | 1421 } |
| 1472 class C extends A { | 1422 class C extends A { |
| 1473 int fieldC; | 1423 int fieldC; |
| 1474 } | 1424 } |
| 1475 main(B b, C c) { | 1425 main(B b, C c) { |
| 1476 b.a.!1; | 1426 b.a.!1; |
| 1477 c.!2; | 1427 c.!2; |
| 1478 }''', | 1428 }''', |
| 1479 <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"], | 1429 <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"], |
| 1480 failingTests: '1'); | 1430 failingTests: '1'); |
| 1481 | 1431 |
| 1482 CompletionTestCase.buildTests( | 1432 buildTests('testCompletion_return_withIdentifierPrefix', ''' |
| 1483 'testCompletion_return_withIdentifierPrefix', | |
| 1484 ''' | |
| 1485 f() { var vvv = 42; return v!1 }''', <String>["1+vvv"]); | 1433 f() { var vvv = 42; return v!1 }''', <String>["1+vvv"]); |
| 1486 | 1434 |
| 1487 CompletionTestCase.buildTests('testCompletion_return_withoutExpression', ''' | 1435 buildTests('testCompletion_return_withoutExpression', ''' |
| 1488 f() { var vvv = 42; return !1 }''', <String>["1+vvv"]); | 1436 f() { var vvv = 42; return !1 }''', <String>["1+vvv"]); |
| 1489 | 1437 |
| 1490 CompletionTestCase.buildTests('testCompletion_staticField1', ''' | 1438 buildTests('testCompletion_staticField1', ''' |
| 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 }}''', | 1439 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo
wer() {x!Xc = y!Yc = MA!1 }}''', |
| 1492 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"], | 1440 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"], |
| 1493 failingTests: '234'); | 1441 failingTests: '234'); |
| 1494 | 1442 |
| 1495 CompletionTestCase.buildTests('testCompletion_super_superType', ''' | 1443 buildTests('testCompletion_super_superType', ''' |
| 1496 class A { | 1444 class A { |
| 1497 var fa; | 1445 var fa; |
| 1498 ma() {} | 1446 ma() {} |
| 1499 } | 1447 } |
| 1500 class B extends A { | 1448 class B extends A { |
| 1501 var fb; | 1449 var fb; |
| 1502 mb() {} | 1450 mb() {} |
| 1503 main() { | 1451 main() { |
| 1504 super.!1 | 1452 super.!1 |
| 1505 } | 1453 } |
| 1506 }''', <String>["1+fa", "1-fb", "1+ma", "1-mb"], failingTests: '1'); | 1454 }''', <String>["1+fa", "1-fb", "1+ma", "1-mb"], failingTests: '1'); |
| 1507 | 1455 |
| 1508 CompletionTestCase.buildTests( | 1456 buildTests('testCompletion_superConstructorInvocation_noNamePrefix', ''' |
| 1509 'testCompletion_superConstructorInvocation_noNamePrefix', | |
| 1510 ''' | |
| 1511 class A { | 1457 class A { |
| 1512 A.fooA(); | 1458 A.fooA(); |
| 1513 A.fooB(); | 1459 A.fooB(); |
| 1514 A.bar(); | 1460 A.bar(); |
| 1515 } | 1461 } |
| 1516 class B extends A { | 1462 class B extends A { |
| 1517 B() : super.!1 | 1463 B() : super.!1 |
| 1518 }''', <String>["1+fooA", "1+fooB", "1+bar"], failingTests: '1'); | 1464 }''', <String>["1+fooA", "1+fooB", "1+bar"], failingTests: '1'); |
| 1519 | 1465 |
| 1520 CompletionTestCase.buildTests( | 1466 buildTests('testCompletion_superConstructorInvocation_withNamePrefix', ''' |
| 1521 'testCompletion_superConstructorInvocation_withNamePrefix', | |
| 1522 ''' | |
| 1523 class A { | 1467 class A { |
| 1524 A.fooA(); | 1468 A.fooA(); |
| 1525 A.fooB(); | 1469 A.fooB(); |
| 1526 A.bar(); | 1470 A.bar(); |
| 1527 } | 1471 } |
| 1528 class B extends A { | 1472 class B extends A { |
| 1529 B() : super.f!1 | 1473 B() : super.f!1 |
| 1530 }''', <String>["1+fooA", "1+fooB", "1-bar"], failingTests: '1'); | 1474 }''', <String>["1+fooA", "1+fooB", "1-bar"], failingTests: '1'); |
| 1531 | 1475 |
| 1532 CompletionTestCase.buildTests( | 1476 buildTests('testCompletion_this_bad_inConstructorInitializer', ''' |
| 1533 'testCompletion_this_bad_inConstructorInitializer', | |
| 1534 ''' | |
| 1535 class A { | 1477 class A { |
| 1536 var f; | 1478 var f; |
| 1537 A() : f = this.!1; | 1479 A() : f = this.!1; |
| 1538 }''', <String>["1-toString"], failingTests: '1'); | 1480 }''', <String>["1-toString"], failingTests: '1'); |
| 1539 | 1481 |
| 1540 CompletionTestCase.buildTests( | 1482 buildTests('testCompletion_this_bad_inFieldDeclaration', ''' |
| 1541 'testCompletion_this_bad_inFieldDeclaration', | |
| 1542 ''' | |
| 1543 class A { | 1483 class A { |
| 1544 var f = this.!1; | 1484 var f = this.!1; |
| 1545 }''', <String>["1-toString"], failingTests: '1'); | 1485 }''', <String>["1-toString"], failingTests: '1'); |
| 1546 | 1486 |
| 1547 CompletionTestCase.buildTests('testCompletion_this_bad_inStaticMethod', ''' | 1487 buildTests('testCompletion_this_bad_inStaticMethod', ''' |
| 1548 class A { | 1488 class A { |
| 1549 static m() { | 1489 static m() { |
| 1550 this.!1; | 1490 this.!1; |
| 1551 } | 1491 } |
| 1552 }''', <String>["1-toString"], failingTests: '1'); | 1492 }''', <String>["1-toString"], failingTests: '1'); |
| 1553 | 1493 |
| 1554 CompletionTestCase.buildTests( | 1494 buildTests('testCompletion_this_bad_inTopLevelFunction', ''' |
| 1555 'testCompletion_this_bad_inTopLevelFunction', | |
| 1556 ''' | |
| 1557 main() { | 1495 main() { |
| 1558 this.!1; | 1496 this.!1; |
| 1559 }''', <String>["1-toString"], failingTests: '1'); | 1497 }''', <String>["1-toString"], failingTests: '1'); |
| 1560 | 1498 |
| 1561 CompletionTestCase.buildTests( | 1499 buildTests('testCompletion_this_bad_inTopLevelVariableDeclaration', ''' |
| 1562 'testCompletion_this_bad_inTopLevelVariableDeclaration', | |
| 1563 ''' | |
| 1564 var v = this.!1;''', <String>["1-toString"], failingTests: '1'); | 1500 var v = this.!1;''', <String>["1-toString"], failingTests: '1'); |
| 1565 | 1501 |
| 1566 CompletionTestCase.buildTests( | 1502 buildTests('testCompletion_this_OK_inConstructorBody', ''' |
| 1567 'testCompletion_this_OK_inConstructorBody', | |
| 1568 ''' | |
| 1569 class A { | 1503 class A { |
| 1570 var f; | 1504 var f; |
| 1571 m() {} | 1505 m() {} |
| 1572 A() { | 1506 A() { |
| 1573 this.!1; | 1507 this.!1; |
| 1574 } | 1508 } |
| 1575 }''', <String>["1+f", "1+m"]); | 1509 }''', <String>["1+f", "1+m"]); |
| 1576 | 1510 |
| 1577 CompletionTestCase.buildTests('testCompletion_this_OK_localAndSuper', ''' | 1511 buildTests('testCompletion_this_OK_localAndSuper', ''' |
| 1578 class A { | 1512 class A { |
| 1579 var fa; | 1513 var fa; |
| 1580 ma() {} | 1514 ma() {} |
| 1581 } | 1515 } |
| 1582 class B extends A { | 1516 class B extends A { |
| 1583 var fb; | 1517 var fb; |
| 1584 mb() {} | 1518 mb() {} |
| 1585 main() { | 1519 main() { |
| 1586 this.!1 | 1520 this.!1 |
| 1587 } | 1521 } |
| 1588 }''', <String>["1+fa", "1+fb", "1+ma", "1+mb"]); | 1522 }''', <String>["1+fa", "1+fb", "1+ma", "1+mb"]); |
| 1589 | 1523 |
| 1590 CompletionTestCase.buildTests('testCompletion_topLevelField_init2', ''' | 1524 buildTests('testCompletion_topLevelField_init2', ''' |
| 1591 class DateTime{static var JUN;}final num M = Dat!1eTime.JUN;''', | 1525 class DateTime{static var JUN;}final num M = Dat!1eTime.JUN;''', |
| 1592 <String>["1+DateTime", "1-void"], | 1526 <String>["1+DateTime", "1-void"], |
| 1593 failingTests: '1'); | 1527 failingTests: '1'); |
| 1594 | 1528 |
| 1595 CompletionTestCase.buildTests('testCompletion_while', ''' | 1529 buildTests('testCompletion_while', ''' |
| 1596 class Foo { int boo = 7; mth() { while (b!1) {} }}''', <String>["1+boo"]); | 1530 class Foo { int boo = 7; mth() { while (b!1) {} }}''', <String>["1+boo"]); |
| 1597 } | 1531 } |
| 1598 | 1532 |
| 1599 void buildLibraryTests() { | 1533 void buildLibraryTests() { |
| 1600 Map<String, String> sources = new HashMap<String, String>(); | 1534 Map<String, String> sources = new HashMap<String, String>(); |
| 1601 | 1535 |
| 1602 CompletionTestCase.buildTests('test_export_ignoreIfThisLibraryExports', ''' | 1536 buildTests('test_export_ignoreIfThisLibraryExports', ''' |
| 1603 export 'dart:math'; | 1537 export 'dart:math'; |
| 1604 libFunction() {}; | 1538 libFunction() {}; |
| 1605 main() { | 1539 main() { |
| 1606 !1 | 1540 !1 |
| 1607 }''', <String>["1-cos", "1+libFunction"]); | 1541 }''', <String>["1-cos", "1+libFunction"]); |
| 1608 | 1542 |
| 1609 sources.clear(); | 1543 sources.clear(); |
| 1610 sources["/lib.dart"] = ''' | 1544 sources["/lib.dart"] = ''' |
| 1611 library lib; | 1545 library lib; |
| 1612 export 'dart:math' hide sin; | 1546 export 'dart:math' hide sin; |
| 1613 libFunction() {};'''; | 1547 libFunction() {};'''; |
| 1614 CompletionTestCase.buildTests( | 1548 buildTests('test_export_showIfImportLibraryWithExport', ''' |
| 1615 'test_export_showIfImportLibraryWithExport', | |
| 1616 ''' | |
| 1617 import 'lib.dart' as p; | 1549 import 'lib.dart' as p; |
| 1618 main() { | 1550 main() { |
| 1619 p.!1 | 1551 p.!1 |
| 1620 }''', | 1552 }''', |
| 1621 <String>["1+cos", "1-sin", "1+libFunction"], | 1553 <String>["1+cos", "1-sin", "1+libFunction"], |
| 1622 extraFiles: sources, | 1554 extraFiles: sources, |
| 1623 failingTests: '1'); | 1555 failingTests: '1'); |
| 1624 | 1556 |
| 1625 CompletionTestCase.buildTests('test_importPrefix_hideCombinator', ''' | 1557 buildTests('test_importPrefix_hideCombinator', ''' |
| 1626 import 'dart:math' as math hide PI; | 1558 import 'dart:math' as math hide PI; |
| 1627 main() { | 1559 main() { |
| 1628 math.!1 | 1560 math.!1 |
| 1629 }''', <String>["1-PI", "1+LN10"], failingTests: '1'); | 1561 }''', <String>["1-PI", "1+LN10"], failingTests: '1'); |
| 1630 | 1562 |
| 1631 CompletionTestCase.buildTests('test_importPrefix_showCombinator', ''' | 1563 buildTests('test_importPrefix_showCombinator', ''' |
| 1632 import 'dart:math' as math show PI; | 1564 import 'dart:math' as math show PI; |
| 1633 main() { | 1565 main() { |
| 1634 math.!1 | 1566 math.!1 |
| 1635 }''', <String>["1+PI", "1-LN10"]); | 1567 }''', <String>["1+PI", "1-LN10"]); |
| 1636 | 1568 |
| 1637 sources.clear(); | 1569 sources.clear(); |
| 1638 sources["/lib.dart"] = ''' | 1570 sources["/lib.dart"] = ''' |
| 1639 library lib | 1571 library lib |
| 1640 class _A | 1572 class _A |
| 1641 foo() {} | 1573 foo() {} |
| 1642 | 1574 |
| 1643 class A extends _A { | 1575 class A extends _A { |
| 1644 }'''; | 1576 }'''; |
| 1645 CompletionTestCase.buildTests('test_memberOfPrivateClass_otherLibrary', ''' | 1577 buildTests('test_memberOfPrivateClass_otherLibrary', ''' |
| 1646 import 'lib.dart'; | 1578 import 'lib.dart'; |
| 1647 main(A a) { | 1579 main(A a) { |
| 1648 a.!1 | 1580 a.!1 |
| 1649 }''', <String>["1+foo"], extraFiles: sources, failingTests: '1'); | 1581 }''', <String>["1+foo"], extraFiles: sources, failingTests: '1'); |
| 1650 | 1582 |
| 1651 sources.clear(); | 1583 sources.clear(); |
| 1652 sources["/lib.dart"] = ''' | 1584 sources["/lib.dart"] = ''' |
| 1653 library lib; | 1585 library lib; |
| 1654 class A { | 1586 class A { |
| 1655 A.c(); | 1587 A.c(); |
| 1656 A._c(); | 1588 A._c(); |
| 1657 }'''; | 1589 }'''; |
| 1658 CompletionTestCase.buildTests( | 1590 buildTests('test_noPrivateElement_otherLibrary_constructor', ''' |
| 1659 'test_noPrivateElement_otherLibrary_constructor', | |
| 1660 ''' | |
| 1661 import 'lib.dart'; | 1591 import 'lib.dart'; |
| 1662 main() { | 1592 main() { |
| 1663 new A.!1 | 1593 new A.!1 |
| 1664 }''', <String>["1-_c", "1+c"], failingTests: '1'); | 1594 }''', <String>["1-_c", "1+c"], failingTests: '1'); |
| 1665 | 1595 |
| 1666 sources.clear(); | 1596 sources.clear(); |
| 1667 sources["/lib.dart"] = ''' | 1597 sources["/lib.dart"] = ''' |
| 1668 library lib; | 1598 library lib; |
| 1669 class A { | 1599 class A { |
| 1670 var f; | 1600 var f; |
| 1671 var _f; | 1601 var _f; |
| 1672 }'''; | 1602 }'''; |
| 1673 CompletionTestCase.buildTests( | 1603 buildTests('test_noPrivateElement_otherLibrary_member', ''' |
| 1674 'test_noPrivateElement_otherLibrary_member', | |
| 1675 ''' | |
| 1676 import 'lib.dart'; | 1604 import 'lib.dart'; |
| 1677 main(A a) { | 1605 main(A a) { |
| 1678 a.!1 | 1606 a.!1 |
| 1679 }''', | 1607 }''', |
| 1680 <String>["1-_f", "1+f"], | 1608 <String>["1-_f", "1+f"], |
| 1681 extraFiles: sources, | 1609 extraFiles: sources, |
| 1682 failingTests: '1'); | 1610 failingTests: '1'); |
| 1683 | 1611 |
| 1684 sources.clear(); | 1612 sources.clear(); |
| 1685 sources["/firth.dart"] = ''' | 1613 sources["/firth.dart"] = ''' |
| 1686 library firth; | 1614 library firth; |
| 1687 class SerializationException { | 1615 class SerializationException { |
| 1688 const SerializationException(); | 1616 const SerializationException(); |
| 1689 }'''; | 1617 }'''; |
| 1690 CompletionTestCase.buildTests('test001', ''' | 1618 buildTests('test001', ''' |
| 1691 import 'firth.dart'; | 1619 import 'firth.dart'; |
| 1692 main() { | 1620 main() { |
| 1693 throw new Seria!1lizationException();}''', | 1621 throw new Seria!1lizationException();}''', |
| 1694 <String>["1+SerializationException"], | 1622 <String>["1+SerializationException"], |
| 1695 extraFiles: sources, | 1623 extraFiles: sources, |
| 1696 failingTests: '1'); | 1624 failingTests: '1'); |
| 1697 | 1625 |
| 1698 // Type propagation. | 1626 // Type propagation. |
| 1699 // TODO Include corelib analysis (this works in the editor) | 1627 // TODO Include corelib analysis (this works in the editor) |
| 1700 CompletionTestCase.buildTests( | 1628 buildTests( |
| 1701 'test002', | 1629 'test002', |
| 1702 '''t2() {var q=[0],z=q.!1length;q.!2clear();}''', | 1630 '''t2() {var q=[0],z=q.!1length;q.!2clear();}''', |
| 1703 <String>["1+length", "1+isEmpty", "2+clear"], | 1631 <String>["1+length", "1+isEmpty", "2+clear"], |
| 1704 failingTests: '12'); | 1632 failingTests: '12'); |
| 1705 | 1633 |
| 1706 // TODO Include corelib analysis | 1634 // TODO Include corelib analysis |
| 1707 CompletionTestCase.buildTests( | 1635 buildTests( |
| 1708 'test003', | 1636 'test003', |
| 1709 '''class X{var q; f() {q.!1a!2}}''', | 1637 '''class X{var q; f() {q.!1a!2}}''', |
| 1710 <String>["1+end", "2+abs", "2-end"], | 1638 <String>["1+end", "2+abs", "2-end"], |
| 1711 failingTests: '12'); | 1639 failingTests: '12'); |
| 1712 | 1640 |
| 1713 // TODO Include corelib analysis | 1641 // TODO Include corelib analysis |
| 1714 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s | 1642 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s |
| 1715 CompletionTestCase.buildTests('test004', ''' | 1643 buildTests('test004', ''' |
| 1716 library foo; | 1644 library foo; |
| 1717 import 'dart:convert' as json; | 1645 import 'dart:convert' as json; |
| 1718 class JsonParserX{} | 1646 class JsonParserX{} |
| 1719 f1() {var x=new json.!1} | 1647 f1() {var x=new json.!1} |
| 1720 f2() {var x=new json.JsonPa!2} | 1648 f2() {var x=new json.JsonPa!2} |
| 1721 f3() {var x=new json.JsonParser!3}''', | 1649 f3() {var x=new json.JsonParser!3}''', |
| 1722 <String>[ | 1650 <String>[ |
| 1723 "1+JsonParser", | 1651 "1+JsonParser", |
| 1724 "1-JsonParserX", | 1652 "1-JsonParserX", |
| 1725 "2+JsonParser", | 1653 "2+JsonParser", |
| 1726 "2-JsonParserX", | 1654 "2-JsonParserX", |
| 1727 "3+JsonParser", | 1655 "3+JsonParser", |
| 1728 "3-JsonParserX"], | 1656 "3-JsonParserX"], |
| 1729 failingTests: '123'); | 1657 failingTests: '123'); |
| 1730 | 1658 |
| 1731 // TODO Enable after type propagation is implemented. Not yet. | 1659 // TODO Enable after type propagation is implemented. Not yet. |
| 1732 // TODO Include corelib analysis | 1660 // TODO Include corelib analysis |
| 1733 CompletionTestCase.buildTests( | 1661 buildTests( |
| 1734 'test005', | 1662 'test005', |
| 1735 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', | 1663 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', |
| 1736 <String>["1+abs"], | 1664 <String>["1+abs"], |
| 1737 failingTests: '1'); | 1665 failingTests: '1'); |
| 1738 | 1666 |
| 1739 // Exercise import and export handling. | 1667 // Exercise import and export handling. |
| 1740 // Libraries are defined in partial order of increasing dependency. | 1668 // Libraries are defined in partial order of increasing dependency. |
| 1741 sources.clear(); | 1669 sources.clear(); |
| 1742 sources["/exp2a.dart"] = ''' | 1670 sources["/exp2a.dart"] = ''' |
| 1743 library exp2a; | 1671 library exp2a; |
| 1744 e2a() {}'''; | 1672 e2a() {}'''; |
| 1745 sources["/exp1b.dart"] = ''' | 1673 sources["/exp1b.dart"] = ''' |
| 1746 library exp1b;", | 1674 library exp1b;", |
| 1747 e1b() {}'''; | 1675 e1b() {}'''; |
| 1748 sources["/exp1a.dart"] = ''' | 1676 sources["/exp1a.dart"] = ''' |
| 1749 library exp1a;", | 1677 library exp1a;", |
| 1750 export 'exp1b.dart';", | 1678 export 'exp1b.dart';", |
| 1751 e1a() {}'''; | 1679 e1a() {}'''; |
| 1752 sources["/imp1.dart"] = ''' | 1680 sources["/imp1.dart"] = ''' |
| 1753 library imp1; | 1681 library imp1; |
| 1754 export 'exp1a.dart'; | 1682 export 'exp1a.dart'; |
| 1755 i1() {}'''; | 1683 i1() {}'''; |
| 1756 sources["/imp2.dart"] = ''' | 1684 sources["/imp2.dart"] = ''' |
| 1757 library imp2; | 1685 library imp2; |
| 1758 export 'exp2a.dart'; | 1686 export 'exp2a.dart'; |
| 1759 i2() {}'''; | 1687 i2() {}'''; |
| 1760 CompletionTestCase.buildTests('test006', ''' | 1688 buildTests('test006', ''' |
| 1761 import 'imp1.dart'; | 1689 import 'imp1.dart'; |
| 1762 import 'imp2.dart'; | 1690 import 'imp2.dart'; |
| 1763 main() {!1 | 1691 main() {!1 |
| 1764 i1(); | 1692 i1(); |
| 1765 i2(); | 1693 i2(); |
| 1766 e1a(); | 1694 e1a(); |
| 1767 e1b(); | 1695 e1b(); |
| 1768 e2a(); | 1696 e2a(); |
| 1769 }''', | 1697 }''', |
| 1770 <String>["1+i1", "1+i2", "1+e1a", "1+e2a", "1+e1b"], | 1698 <String>["1+i1", "1+i2", "1+e1a", "1+e2a", "1+e1b"], |
| 1771 extraFiles: sources, | 1699 extraFiles: sources, |
| 1772 failingTests: '1'); | 1700 failingTests: '1'); |
| 1773 | 1701 |
| 1774 // Exercise import and export handling. | 1702 // Exercise import and export handling. |
| 1775 // Libraries are defined in partial order of increasing dependency. | 1703 // Libraries are defined in partial order of increasing dependency. |
| 1776 sources.clear(); | 1704 sources.clear(); |
| 1777 sources["/l1.dart"] = ''' | 1705 sources["/l1.dart"] = ''' |
| 1778 library l1; | 1706 library l1; |
| 1779 var _l1t; var l1t;'''; | 1707 var _l1t; var l1t;'''; |
| 1780 CompletionTestCase.buildTests('test007', ''' | 1708 buildTests('test007', ''' |
| 1781 import 'l1.dart'; | 1709 import 'l1.dart'; |
| 1782 main() { | 1710 main() { |
| 1783 var x = l!1 | 1711 var x = l!1 |
| 1784 var y = _!2 | 1712 var y = _!2 |
| 1785 }''', | 1713 }''', |
| 1786 <String>["1+l1t", "1-_l1t", "2-_l1t"], | 1714 <String>["1+l1t", "1-_l1t", "2-_l1t"], |
| 1787 extraFiles: sources, | 1715 extraFiles: sources, |
| 1788 failingTests: '1'); | 1716 failingTests: '1'); |
| 1789 | 1717 |
| 1790 // Check private library exclusion | 1718 // Check private library exclusion |
| 1791 sources.clear(); | 1719 sources.clear(); |
| 1792 sources["/public.dart"] = ''' | 1720 sources["/public.dart"] = ''' |
| 1793 library public; | 1721 library public; |
| 1794 class NonPrivate { | 1722 class NonPrivate { |
| 1795 void publicMethod() { | 1723 void publicMethod() { |
| 1796 } | 1724 } |
| 1797 }'''; | 1725 }'''; |
| 1798 sources["/private.dart"] = ''' | 1726 sources["/private.dart"] = ''' |
| 1799 library _private; | 1727 library _private; |
| 1800 import 'public.dart'; | 1728 import 'public.dart'; |
| 1801 class Private extends NonPrivate { | 1729 class Private extends NonPrivate { |
| 1802 void privateMethod() { | 1730 void privateMethod() { |
| 1803 } | 1731 } |
| 1804 }'''; | 1732 }'''; |
| 1805 CompletionTestCase.buildTests('test008', ''' | 1733 buildTests('test008', ''' |
| 1806 import 'private.dart'; | 1734 import 'private.dart'; |
| 1807 import 'public.dart'; | 1735 import 'public.dart'; |
| 1808 class Test { | 1736 class Test { |
| 1809 void test() { | 1737 void test() { |
| 1810 NonPrivate x = new NonPrivate(); | 1738 NonPrivate x = new NonPrivate(); |
| 1811 x.!1 //publicMethod but not privateMethod should appear | 1739 x.!1 //publicMethod but not privateMethod should appear |
| 1812 } | 1740 } |
| 1813 }''', | 1741 }''', |
| 1814 <String>["1-privateMethod", "1+publicMethod"], | 1742 <String>["1-privateMethod", "1+publicMethod"], |
| 1815 extraFiles: sources, | 1743 extraFiles: sources, |
| 1816 failingTests: '1'); | 1744 failingTests: '1'); |
| 1817 | 1745 |
| 1818 // Exercise library prefixes. | 1746 // Exercise library prefixes. |
| 1819 sources.clear(); | 1747 sources.clear(); |
| 1820 sources["/lib.dart"] = ''' | 1748 sources["/lib.dart"] = ''' |
| 1821 library lib; | 1749 library lib; |
| 1822 int X = 1; | 1750 int X = 1; |
| 1823 void m(){} | 1751 void m(){} |
| 1824 class Y {}'''; | 1752 class Y {}'''; |
| 1825 CompletionTestCase.buildTests('test009', ''' | 1753 buildTests('test009', ''' |
| 1826 import 'lib.dart' as Q; | 1754 import 'lib.dart' as Q; |
| 1827 void a() { | 1755 void a() { |
| 1828 var x = Q.!1 | 1756 var x = Q.!1 |
| 1829 } | 1757 } |
| 1830 void b() { | 1758 void b() { |
| 1831 var x = [Q.!2] | 1759 var x = [Q.!2] |
| 1832 } | 1760 } |
| 1833 void c() { | 1761 void c() { |
| 1834 var x = new List([Q.!3]) | 1762 var x = new List([Q.!3]) |
| 1835 } | 1763 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1847 "3+m", | 1775 "3+m", |
| 1848 "3+Y", | 1776 "3+Y", |
| 1849 "4+Y", | 1777 "4+Y", |
| 1850 "4-m", | 1778 "4-m", |
| 1851 "4-X"], | 1779 "4-X"], |
| 1852 extraFiles: sources, | 1780 extraFiles: sources, |
| 1853 failingTests: '1234'); | 1781 failingTests: '1234'); |
| 1854 } | 1782 } |
| 1855 | 1783 |
| 1856 void buildNumberedTests() { | 1784 void buildNumberedTests() { |
| 1857 CompletionTestCase.buildTests('test001', ''' | 1785 buildTests('test001', ''' |
| 1858 void r1(var v) { | 1786 void r1(var v) { |
| 1859 v.!1toString!2().!3hash!4Code | 1787 v.!1toString!2().!3hash!4Code |
| 1860 }''', | 1788 }''', |
| 1861 <String>[ | 1789 <String>[ |
| 1862 "1+toString", | 1790 "1+toString", |
| 1863 "1-==", | 1791 "1-==", |
| 1864 "2+toString", | 1792 "2+toString", |
| 1865 "3+hashCode", | 1793 "3+hashCode", |
| 1866 "3+toString", | 1794 "3+toString", |
| 1867 "4+hashCode", | 1795 "4+hashCode", |
| 1868 "4-toString"]); | 1796 "4-toString"]); |
| 1869 | 1797 |
| 1870 CompletionTestCase.buildTests('test002', ''' | 1798 buildTests('test002', ''' |
| 1871 void r2(var vim) { | 1799 void r2(var vim) { |
| 1872 v!1.toString() | 1800 v!1.toString() |
| 1873 }''', <String>["1+vim"]); | 1801 }''', <String>["1+vim"]); |
| 1874 | 1802 |
| 1875 CompletionTestCase.buildTests('test003', ''' | 1803 buildTests('test003', ''' |
| 1876 class A { | 1804 class A { |
| 1877 int a() => 3; | 1805 int a() => 3; |
| 1878 int b() => this.!1a(); | 1806 int b() => this.!1a(); |
| 1879 }''', <String>["1+a"]); | 1807 }''', <String>["1+a"]); |
| 1880 | 1808 |
| 1881 CompletionTestCase.buildTests('test004', ''' | 1809 buildTests('test004', ''' |
| 1882 class A { | 1810 class A { |
| 1883 int x; | 1811 int x; |
| 1884 A() : this.!1x = 1; | 1812 A() : this.!1x = 1; |
| 1885 A.b() : this(); | 1813 A.b() : this(); |
| 1886 A.c() : this.!2b(); | 1814 A.c() : this.!2b(); |
| 1887 g() => new A.!3c(); | 1815 g() => new A.!3c(); |
| 1888 }''', <String>["1+x", "2+b", "3+c"], failingTests: '12'); | 1816 }''', <String>["1+x", "2+b", "3+c"], failingTests: '12'); |
| 1889 | 1817 |
| 1890 CompletionTestCase.buildTests('test005', ''' | 1818 buildTests('test005', ''' |
| 1891 class A {} | 1819 class A {} |
| 1892 void rr(var vim) { | 1820 void rr(var vim) { |
| 1893 var !1vq = v!2.toString(); | 1821 var !1vq = v!2.toString(); |
| 1894 var vf; | 1822 var vf; |
| 1895 v!3.toString(); | 1823 v!3.toString(); |
| 1896 }''', | 1824 }''', |
| 1897 <String>[ | 1825 <String>[ |
| 1898 "1-A", | 1826 "1-A", |
| 1899 "1-vim", | 1827 "1-vim", |
| 1900 "1+vq", | 1828 "1+vq", |
| 1901 "1-vf", | 1829 "1-vf", |
| 1902 "1-this", | 1830 "1-this", |
| 1903 "1-void", | 1831 "1-void", |
| 1904 "1-null", | 1832 "1-null", |
| 1905 "1-false", | 1833 "1-false", |
| 1906 "2-A", | 1834 "2-A", |
| 1907 "2+vim", | 1835 "2+vim", |
| 1908 "2-vf", | 1836 "2-vf", |
| 1909 "2-vq", | 1837 "2-vq", |
| 1910 "2-this", | 1838 "2-this", |
| 1911 "2-void", | 1839 "2-void", |
| 1912 "2-null", | 1840 "2-null", |
| 1913 "2-false", | 1841 "2-false", |
| 1914 "3+vf", | 1842 "3+vf", |
| 1915 "3+vq", | 1843 "3+vq", |
| 1916 "3+vim", | 1844 "3+vim", |
| 1917 "3-A"], | 1845 "3-A"], |
| 1918 failingTests: '1'); | 1846 failingTests: '1'); |
| 1919 | 1847 |
| 1920 CompletionTestCase.buildTests('test006', ''' | 1848 buildTests('test006', ''' |
| 1921 void r2(var vim, {va: 2, b: 3}) { | 1849 void r2(var vim, {va: 2, b: 3}) { |
| 1922 v!1.toString() | 1850 v!1.toString() |
| 1923 }''', <String>["1+va", "1-b"]); | 1851 }''', <String>["1+va", "1-b"]); |
| 1924 | 1852 |
| 1925 CompletionTestCase.buildTests('test007', ''' | 1853 buildTests('test007', ''' |
| 1926 void r2(var vim, [va: 2, b: 3]) { | 1854 void r2(var vim, [va: 2, b: 3]) { |
| 1927 v!1.toString() | 1855 v!1.toString() |
| 1928 }''', <String>["1+va", "1-b"]); | 1856 }''', <String>["1+va", "1-b"]); |
| 1929 | 1857 |
| 1930 // keywords | 1858 // keywords |
| 1931 CompletionTestCase.buildTests('test008', ''' | 1859 buildTests('test008', ''' |
| 1932 !1class Aclass {} | 1860 !1class Aclass {} |
| 1933 class Bclass !2extends!3 !4Aclass {} | 1861 class Bclass !2extends!3 !4Aclass {} |
| 1934 !5typedef Ctype = !6Bclass with !7Aclass; | 1862 !5typedef Ctype = !6Bclass with !7Aclass; |
| 1935 class Dclass extends !8Ctype {} | 1863 class Dclass extends !8Ctype {} |
| 1936 !9abstract class Eclass implements Dclass,!C Ctype, Bclass {} | 1864 !9abstract class Eclass implements Dclass,!C Ctype, Bclass {} |
| 1937 class Fclass extends Bclass !Awith !B Eclass {}''', | 1865 class Fclass extends Bclass !Awith !B Eclass {}''', |
| 1938 <String>[ | 1866 <String>[ |
| 1939 "1+class", | 1867 "1+class", |
| 1940 "1-implements", | 1868 "1-implements", |
| 1941 "1-extends", | 1869 "1-extends", |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1953 "9+abstract", | 1881 "9+abstract", |
| 1954 "A+with", | 1882 "A+with", |
| 1955 "B+Eclass", | 1883 "B+Eclass", |
| 1956 "B-Dclass", | 1884 "B-Dclass", |
| 1957 "B-Ctype", | 1885 "B-Ctype", |
| 1958 "C+Bclass", | 1886 "C+Bclass", |
| 1959 "C-Eclass"], | 1887 "C-Eclass"], |
| 1960 failingTests: '12345679ABC'); | 1888 failingTests: '12345679ABC'); |
| 1961 | 1889 |
| 1962 // keywords | 1890 // keywords |
| 1963 CompletionTestCase.buildTests('test009', ''' | 1891 buildTests('test009', ''' |
| 1964 typedef !1dy!2namic TestFn1(); | 1892 typedef !1dy!2namic TestFn1(); |
| 1965 typedef !3vo!4id TestFn2(); | 1893 typedef !3vo!4id TestFn2(); |
| 1966 typ!7edef !5n!6''', | 1894 typ!7edef !5n!6''', |
| 1967 <String>[ | 1895 <String>[ |
| 1968 "1+void", | 1896 "1+void", |
| 1969 "1+TestFn2", | 1897 "1+TestFn2", |
| 1970 "2+dynamic", | 1898 "2+dynamic", |
| 1971 "2-void", | 1899 "2-void", |
| 1972 "3+dynamic", | 1900 "3+dynamic", |
| 1973 "4+void", | 1901 "4+void", |
| 1974 "4-dynamic", | 1902 "4-dynamic", |
| 1975 "5+TestFn2", | 1903 "5+TestFn2", |
| 1976 "6+num", | 1904 "6+num", |
| 1977 "7+typedef"], | 1905 "7+typedef"], |
| 1978 failingTests: '12347'); | 1906 failingTests: '12347'); |
| 1979 | 1907 |
| 1980 CompletionTestCase.buildTests('test010', ''' | 1908 buildTests('test010', ''' |
| 1981 class test !8<!1t !2 !3extends String,!4 List,!5 !6>!7 {} | 1909 class test !8<!1t !2 !3extends String,!4 List,!5 !6>!7 {} |
| 1982 class tezetst !9<!BString,!C !DList>!A {}''', | 1910 class tezetst !9<!BString,!C !DList>!A {}''', |
| 1983 <String>[ | 1911 <String>[ |
| 1984 "1+String", | 1912 "1+String", |
| 1985 "1+List", | 1913 "1+List", |
| 1986 "1-test", | 1914 "1-test", |
| 1987 "2-String", | 1915 "2-String", |
| 1988 "2-test", | 1916 "2-test", |
| 1989 "3+extends", | 1917 "3+extends", |
| 1990 "4+tezetst", | 1918 "4+tezetst", |
| 1991 "4-test", | 1919 "4-test", |
| 1992 "5+String", | 1920 "5+String", |
| 1993 "6+List", | 1921 "6+List", |
| 1994 "7-List", | 1922 "7-List", |
| 1995 "8-List", | 1923 "8-List", |
| 1996 "9-String", | 1924 "9-String", |
| 1997 "A-String", | 1925 "A-String", |
| 1998 "B+String", | 1926 "B+String", |
| 1999 "C+List", | 1927 "C+List", |
| 2000 "C-tezetst", | 1928 "C-tezetst", |
| 2001 "D+List", | 1929 "D+List", |
| 2002 "D+test"], | 1930 "D+test"], |
| 2003 failingTests: '12345C'); | 1931 failingTests: '12345C'); |
| 2004 | 1932 |
| 2005 // name generation with conflicts | 1933 // name generation with conflicts |
| 2006 CompletionTestCase.buildTests( | 1934 buildTests( |
| 2007 'test011', | 1935 'test011', |
| 2008 '''r2(var object, Object object1, Object !1);''', | 1936 '''r2(var object, Object object1, Object !1);''', |
| 2009 <String>["1+object2"], | 1937 <String>["1+object2"], |
| 2010 failingTests: '1'); | 1938 failingTests: '1'); |
| 2011 | 1939 |
| 2012 // reserved words | 1940 // reserved words |
| 2013 CompletionTestCase.buildTests('test012', ''' | 1941 buildTests('test012', ''' |
| 2014 class X { | 1942 class X { |
| 2015 f() { | 1943 f() { |
| 2016 g(!1var!2 z) {!3true.!4toString();}; | 1944 g(!1var!2 z) {!3true.!4toString();}; |
| 2017 } | 1945 } |
| 2018 }''', | 1946 }''', |
| 2019 <String>[ | 1947 <String>[ |
| 2020 "1+var", | 1948 "1+var", |
| 2021 "1+dynamic", | 1949 "1+dynamic", |
| 2022 "1-f", | 1950 "1-f", |
| 2023 "2+var", | 1951 "2+var", |
| 2024 "2-dynamic", | 1952 "2-dynamic", |
| 2025 "3+false", | 1953 "3+false", |
| 2026 "3+true", | 1954 "3+true", |
| 2027 "4+toString"], | 1955 "4+toString"], |
| 2028 failingTests: '123'); | 1956 failingTests: '123'); |
| 2029 | 1957 |
| 2030 // conditions & operators | 1958 // conditions & operators |
| 2031 CompletionTestCase.buildTests('test013', ''' | 1959 buildTests('test013', ''' |
| 2032 class Q { | 1960 class Q { |
| 2033 bool x; | 1961 bool x; |
| 2034 List zs; | 1962 List zs; |
| 2035 int k; | 1963 int k; |
| 2036 var a; | 1964 var a; |
| 2037 mth() { | 1965 mth() { |
| 2038 while (!1x !9); | 1966 while (!1x !9); |
| 2039 do{} while(!2x !8); | 1967 do{} while(!2x !8); |
| 2040 for(z in !3zs) {} | 1968 for(z in !3zs) {} |
| 2041 switch(!4k) {case 1:{!0}} | 1969 switch(!4k) {case 1:{!0}} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2052 "5+Q", | 1980 "5+Q", |
| 2053 "5-a", | 1981 "5-a", |
| 2054 "6+==", | 1982 "6+==", |
| 2055 "7+x", | 1983 "7+x", |
| 2056 "8+==", | 1984 "8+==", |
| 2057 "9+==", | 1985 "9+==", |
| 2058 "0+k"], | 1986 "0+k"], |
| 2059 failingTests: '5689'); | 1987 failingTests: '5689'); |
| 2060 | 1988 |
| 2061 // keywords | 1989 // keywords |
| 2062 CompletionTestCase.buildTests('test014', ''' | 1990 buildTests('test014', ''' |
| 2063 class Q { | 1991 class Q { |
| 2064 bool x; | 1992 bool x; |
| 2065 List zs; | 1993 List zs; |
| 2066 int k; | 1994 int k; |
| 2067 !Dvar a; | 1995 !Dvar a; |
| 2068 !Evoid mth() { | 1996 !Evoid mth() { |
| 2069 !1while (z) { !Gcontinue; }; | 1997 !1while (z) { !Gcontinue; }; |
| 2070 !2do{ !Hbreak; } !3while(x); | 1998 !2do{ !Hbreak; } !3while(x); |
| 2071 !4for(z !5in zs) {} | 1999 !4for(z !5in zs) {} |
| 2072 !6for (int i; i < 3; i++); | 2000 !6for (int i; i < 3; i++); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2095 "E+void", | 2023 "E+void", |
| 2096 "F+assert", | 2024 "F+assert", |
| 2097 "G+continue", | 2025 "G+continue", |
| 2098 "H+break", | 2026 "H+break", |
| 2099 "J+if", | 2027 "J+if", |
| 2100 "K+else", | 2028 "K+else", |
| 2101 "L+return"], | 2029 "L+return"], |
| 2102 failingTests: '123456789ABCDEFGHJKL'); | 2030 failingTests: '123456789ABCDEFGHJKL'); |
| 2103 | 2031 |
| 2104 // operators in function | 2032 // operators in function |
| 2105 CompletionTestCase.buildTests( | 2033 buildTests( |
| 2106 'test015', | 2034 'test015', |
| 2107 '''f(a,b,c) => a + b * c !1;''', | 2035 '''f(a,b,c) => a + b * c !1;''', |
| 2108 <String>["1+=="], | 2036 <String>["1+=="], |
| 2109 failingTests: '1'); | 2037 failingTests: '1'); |
| 2110 | 2038 |
| 2111 // operators in return | 2039 // operators in return |
| 2112 CompletionTestCase.buildTests( | 2040 buildTests( |
| 2113 'test016', | 2041 'test016', |
| 2114 '''class X {dynamic f(a,b,c) {return a + b * c !1;}}''', | 2042 '''class X {dynamic f(a,b,c) {return a + b * c !1;}}''', |
| 2115 <String>["1+=="], | 2043 <String>["1+=="], |
| 2116 failingTests: '1'); | 2044 failingTests: '1'); |
| 2117 | 2045 |
| 2118 // keywords | 2046 // keywords |
| 2119 CompletionTestCase.buildTests('test017', ''' | 2047 buildTests('test017', ''' |
| 2120 !1library foo; | 2048 !1library foo; |
| 2121 !2import 'x' !5as r; | 2049 !2import 'x' !5as r; |
| 2122 !3export '!8uri' !6hide Q !7show X; | 2050 !3export '!8uri' !6hide Q !7show X; |
| 2123 !4part 'x';''', | 2051 !4part 'x';''', |
| 2124 <String>[ | 2052 <String>[ |
| 2125 "1+library", | 2053 "1+library", |
| 2126 "2+import", | 2054 "2+import", |
| 2127 "3+export", | 2055 "3+export", |
| 2128 "4+part", | 2056 "4+part", |
| 2129 "5+as", | 2057 "5+as", |
| 2130 "6+hide", | 2058 "6+hide", |
| 2131 "7+show", | 2059 "7+show", |
| 2132 "8-null"], | 2060 "8-null"], |
| 2133 failingTests: '1234567'); | 2061 failingTests: '1234567'); |
| 2134 | 2062 |
| 2135 // keywords | 2063 // keywords |
| 2136 CompletionTestCase.buildTests( | 2064 buildTests( |
| 2137 'test018', | 2065 'test018', |
| 2138 '''!1part !2of foo;''', | 2066 '''!1part !2of foo;''', |
| 2139 <String>["1+part", "2+of"], | 2067 <String>["1+part", "2+of"], |
| 2140 failingTests: '12'); | 2068 failingTests: '12'); |
| 2141 | 2069 |
| 2142 CompletionTestCase.buildTests('test019', ''' | 2070 buildTests('test019', ''' |
| 2143 var truefalse = 0; | 2071 var truefalse = 0; |
| 2144 var falsetrue = 1; | 2072 var falsetrue = 1; |
| 2145 main() { | 2073 main() { |
| 2146 var foo = true!1 | 2074 var foo = true!1 |
| 2147 }''', <String>["1+true", "1+truefalse", "1-falsetrue"], failingTests: '1'); | 2075 }''', <String>["1+true", "1+truefalse", "1-falsetrue"], failingTests: '1'); |
| 2148 | 2076 |
| 2149 CompletionTestCase.buildTests( | 2077 buildTests( |
| 2150 'test020', | 2078 'test020', |
| 2151 '''var x = null.!1''', | 2079 '''var x = null.!1''', |
| 2152 <String>["1+toString"], | 2080 <String>["1+toString"], |
| 2153 failingTests: '1'); | 2081 failingTests: '1'); |
| 2154 | 2082 |
| 2155 CompletionTestCase.buildTests( | 2083 buildTests( |
| 2156 'test021', | 2084 'test021', |
| 2157 '''var x = .!1''', | 2085 '''var x = .!1''', |
| 2158 <String>["1-toString"], | 2086 <String>["1-toString"], |
| 2159 failingTests: '1'); | 2087 failingTests: '1'); |
| 2160 | 2088 |
| 2161 CompletionTestCase.buildTests( | 2089 buildTests( |
| 2162 'test022', | 2090 'test022', |
| 2163 '''var x = .!1;''', | 2091 '''var x = .!1;''', |
| 2164 <String>["1-toString"], | 2092 <String>["1-toString"], |
| 2165 failingTests: '1'); | 2093 failingTests: '1'); |
| 2166 | 2094 |
| 2167 CompletionTestCase.buildTests('test023', ''' | 2095 buildTests('test023', ''' |
| 2168 class Map{getKeys(){}} | 2096 class Map{getKeys(){}} |
| 2169 class X { | 2097 class X { |
| 2170 static x1(Map m) { | 2098 static x1(Map m) { |
| 2171 m.!1getKeys; | 2099 m.!1getKeys; |
| 2172 } | 2100 } |
| 2173 x2(Map m) { | 2101 x2(Map m) { |
| 2174 m.!2getKeys; | 2102 m.!2getKeys; |
| 2175 } | 2103 } |
| 2176 }''', <String>["1+getKeys", "2+getKeys"]); | 2104 }''', <String>["1+getKeys", "2+getKeys"]); |
| 2177 | 2105 |
| 2178 // Note lack of semicolon following completion location | 2106 // Note lack of semicolon following completion location |
| 2179 CompletionTestCase.buildTests('test024', ''' | 2107 buildTests('test024', ''' |
| 2180 class List{factory List.from(Iterable other) {}} | 2108 class List{factory List.from(Iterable other) {}} |
| 2181 class F { | 2109 class F { |
| 2182 f() { | 2110 f() { |
| 2183 new List.!1 | 2111 new List.!1 |
| 2184 } | 2112 } |
| 2185 }''', <String>["1+from"]); | 2113 }''', <String>["1+from"]); |
| 2186 | 2114 |
| 2187 CompletionTestCase.buildTests('test025', ''' | 2115 buildTests('test025', ''' |
| 2188 class R { | 2116 class R { |
| 2189 static R _m; | 2117 static R _m; |
| 2190 static R m; | 2118 static R m; |
| 2191 f() { | 2119 f() { |
| 2192 var a = !1m; | 2120 var a = !1m; |
| 2193 var b = _!2m; | 2121 var b = _!2m; |
| 2194 var c = !3g(); | 2122 var c = !3g(); |
| 2195 } | 2123 } |
| 2196 static g() { | 2124 static g() { |
| 2197 var a = !4m; | 2125 var a = !4m; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2228 "8-m", | 2156 "8-m", |
| 2229 "9-_m", | 2157 "9-_m", |
| 2230 "A+_m", | 2158 "A+_m", |
| 2231 "B+m", | 2159 "B+m", |
| 2232 "C+g", | 2160 "C+g", |
| 2233 "D+_m", | 2161 "D+_m", |
| 2234 "E+m", | 2162 "E+m", |
| 2235 "F+g"], | 2163 "F+g"], |
| 2236 failingTests: '789'); | 2164 failingTests: '789'); |
| 2237 | 2165 |
| 2238 CompletionTestCase.buildTests( | 2166 buildTests('test026', '''var aBcD; var x=ab!1''', <String>["1+aBcD"]); |
| 2239 'test026', | |
| 2240 '''var aBcD; var x=ab!1''', | |
| 2241 <String>["1+aBcD"]); | |
| 2242 | 2167 |
| 2243 CompletionTestCase.buildTests( | 2168 buildTests( |
| 2244 'test027', | 2169 'test027', |
| 2245 '''m(){try{}catch(eeee,ssss){s!1}''', | 2170 '''m(){try{}catch(eeee,ssss){s!1}''', |
| 2246 <String>["1+ssss"]); | 2171 <String>["1+ssss"]); |
| 2247 | 2172 |
| 2248 CompletionTestCase.buildTests( | 2173 buildTests('test028', '''m(){var isX=3;if(is!1)''', <String>["1+isX"]); |
| 2249 'test028', | |
| 2250 '''m(){var isX=3;if(is!1)''', | |
| 2251 <String>["1+isX"]); | |
| 2252 | 2174 |
| 2253 CompletionTestCase.buildTests( | 2175 buildTests('test029', '''m(){[1].forEach((x)=>!1x);}''', <String>["1+x"]); |
| 2254 'test029', | |
| 2255 '''m(){[1].forEach((x)=>!1x);}''', | |
| 2256 <String>["1+x"]); | |
| 2257 | 2176 |
| 2258 CompletionTestCase.buildTests( | 2177 buildTests('test030', '''n(){[1].forEach((x){!1});}''', <String>["1+x"]); |
| 2259 'test030', | |
| 2260 '''n(){[1].forEach((x){!1});}''', | |
| 2261 <String>["1+x"]); | |
| 2262 | 2178 |
| 2263 CompletionTestCase.buildTests( | 2179 buildTests( |
| 2264 'test031', | 2180 'test031', |
| 2265 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''', | 2181 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''', |
| 2266 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"], | 2182 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"], |
| 2267 failingTests: '1'); | 2183 failingTests: '1'); |
| 2268 | 2184 |
| 2269 CompletionTestCase.buildTests('test032', ''' | 2185 buildTests('test032', ''' |
| 2270 const ONE = 1; | 2186 const ONE = 1; |
| 2271 const ICHI = 10; | 2187 const ICHI = 10; |
| 2272 const UKSI = 100; | 2188 const UKSI = 100; |
| 2273 const EIN = 1000; | 2189 const EIN = 1000; |
| 2274 m() { | 2190 m() { |
| 2275 int x; | 2191 int x; |
| 2276 switch (x) { | 2192 switch (x) { |
| 2277 case !3ICHI: | 2193 case !3ICHI: |
| 2278 case UKSI: | 2194 case UKSI: |
| 2279 case EIN!2: | 2195 case EIN!2: |
| 2280 case ONE!1: return; | 2196 case ONE!1: return; |
| 2281 default: return; | 2197 default: return; |
| 2282 } | 2198 } |
| 2283 }''', | 2199 }''', |
| 2284 <String>[ | 2200 <String>[ |
| 2285 "1+ONE", | 2201 "1+ONE", |
| 2286 "1-UKSI", | 2202 "1-UKSI", |
| 2287 "2+EIN", | 2203 "2+EIN", |
| 2288 "2-ICHI", | 2204 "2-ICHI", |
| 2289 "3+ICHI", | 2205 "3+ICHI", |
| 2290 "3+UKSI", | 2206 "3+UKSI", |
| 2291 "3+EIN", | 2207 "3+EIN", |
| 2292 "3+ONE"]); | 2208 "3+ONE"]); |
| 2293 | 2209 |
| 2294 CompletionTestCase.buildTests( | 2210 buildTests( |
| 2295 'test033', | 2211 'test033', |
| 2296 '''class A{}class B extends A{b(){}}class C implements A {c(){}}class X{
x(){A f;f.!1}}''', | 2212 '''class A{}class B extends A{b(){}}class C implements A {c(){}}class X{
x(){A f;f.!1}}''', |
| 2297 <String>["1+b", "1-c"], | 2213 <String>["1+b", "1-c"], |
| 2298 failingTests: '1'); | 2214 failingTests: '1'); |
| 2299 | 2215 |
| 2300 // TODO(scheglov) decide what to do with Type for untyped field (not | 2216 // TODO(scheglov) decide what to do with Type for untyped field (not |
| 2301 // supported by the new store) | 2217 // supported by the new store) |
| 2302 // test analysis of untyped fields and top-level vars | 2218 // test analysis of untyped fields and top-level vars |
| 2303 CompletionTestCase.buildTests('test034', ''' | 2219 buildTests('test034', ''' |
| 2304 var topvar; | 2220 var topvar; |
| 2305 class Top {top(){}} | 2221 class Top {top(){}} |
| 2306 class Left extends Top {left(){}} | 2222 class Left extends Top {left(){}} |
| 2307 class Right extends Top {right(){}} | 2223 class Right extends Top {right(){}} |
| 2308 t1() { | 2224 t1() { |
| 2309 topvar = new Left(); | 2225 topvar = new Left(); |
| 2310 } | 2226 } |
| 2311 t2() { | 2227 t2() { |
| 2312 topvar = new Right(); | 2228 topvar = new Right(); |
| 2313 } | 2229 } |
| 2314 class A { | 2230 class A { |
| 2315 var field; | 2231 var field; |
| 2316 a() { | 2232 a() { |
| 2317 field = new Left(); | 2233 field = new Left(); |
| 2318 } | 2234 } |
| 2319 b() { | 2235 b() { |
| 2320 field = new Right(); | 2236 field = new Right(); |
| 2321 } | 2237 } |
| 2322 test() { | 2238 test() { |
| 2323 topvar.!1top(); | 2239 topvar.!1top(); |
| 2324 field.!2top(); | 2240 field.!2top(); |
| 2325 } | 2241 } |
| 2326 }''', <String>["1+top", "2+top"], failingTests: '12'); | 2242 }''', <String>["1+top", "2+top"], failingTests: '12'); |
| 2327 | 2243 |
| 2328 // test analysis of untyped fields and top-level vars | 2244 // test analysis of untyped fields and top-level vars |
| 2329 CompletionTestCase.buildTests( | 2245 buildTests( |
| 2330 'test035', | 2246 'test035', |
| 2331 '''class Y {final x='hi';mth() {x.!1length;}}''', | 2247 '''class Y {final x='hi';mth() {x.!1length;}}''', |
| 2332 <String>["1+length"], | 2248 <String>["1+length"], |
| 2333 failingTests: '1'); | 2249 failingTests: '1'); |
| 2334 | 2250 |
| 2335 // TODO(scheglov) decide what to do with Type for untyped field (not | 2251 // TODO(scheglov) decide what to do with Type for untyped field (not |
| 2336 // supported by the new store) | 2252 // supported by the new store) |
| 2337 // test analysis of untyped fields and top-level vars | 2253 // test analysis of untyped fields and top-level vars |
| 2338 CompletionTestCase.buildTests('test036', ''' | 2254 buildTests('test036', ''' |
| 2339 class A1 { | 2255 class A1 { |
| 2340 var field; | 2256 var field; |
| 2341 A1() : field = 0; | 2257 A1() : field = 0; |
| 2342 q() { | 2258 q() { |
| 2343 A1 a = new A1(); | 2259 A1 a = new A1(); |
| 2344 a.field.!1 | 2260 a.field.!1 |
| 2345 } | 2261 } |
| 2346 } | 2262 } |
| 2347 main() { | 2263 main() { |
| 2348 A1 a = new A1(); | 2264 A1 a = new A1(); |
| 2349 a.field.!2 | 2265 a.field.!2 |
| 2350 }''', <String>["1+round", "2+round"], failingTests: '12'); | 2266 }''', <String>["1+round", "2+round"], failingTests: '12'); |
| 2351 | 2267 |
| 2352 CompletionTestCase.buildTests('test037', ''' | 2268 buildTests('test037', ''' |
| 2353 class HttpServer{} | 2269 class HttpServer{} |
| 2354 class HttpClient{} | 2270 class HttpClient{} |
| 2355 main() { | 2271 main() { |
| 2356 new HtS!1 | 2272 new HtS!1 |
| 2357 }''', <String>["1+HttpServer", "1-HttpClient"], failingTests: '1'); | 2273 }''', <String>["1+HttpServer", "1-HttpClient"], failingTests: '1'); |
| 2358 | 2274 |
| 2359 CompletionTestCase.buildTests('test038', ''' | 2275 buildTests('test038', ''' |
| 2360 class X { | 2276 class X { |
| 2361 x(){} | 2277 x(){} |
| 2362 } | 2278 } |
| 2363 class Y { | 2279 class Y { |
| 2364 y(){} | 2280 y(){} |
| 2365 } | 2281 } |
| 2366 class A<Z extends X> { | 2282 class A<Z extends X> { |
| 2367 Y ay; | 2283 Y ay; |
| 2368 Z az; | 2284 Z az; |
| 2369 A(this.ay, this.az) { | 2285 A(this.ay, this.az) { |
| 2370 ay.!1y; | 2286 ay.!1y; |
| 2371 az.!2x; | 2287 az.!2x; |
| 2372 } | 2288 } |
| 2373 }''', <String>["1+y", "1-x", "2+x", "2-y"], failingTests: '2'); | 2289 }''', <String>["1+y", "1-x", "2+x", "2-y"], failingTests: '2'); |
| 2374 | 2290 |
| 2375 // test analysis of untyped fields and top-level vars | 2291 // test analysis of untyped fields and top-level vars |
| 2376 CompletionTestCase.buildTests( | 2292 buildTests( |
| 2377 'test039', | 2293 'test039', |
| 2378 '''class X{}var x = null as !1X;''', | 2294 '''class X{}var x = null as !1X;''', |
| 2379 <String>["1+X", "1-void"]); | 2295 <String>["1+X", "1-void"]); |
| 2380 | 2296 |
| 2381 // test arg lists with named params | 2297 // test arg lists with named params |
| 2382 CompletionTestCase.buildTests( | 2298 buildTests( |
| 2383 'test040', | 2299 'test040', |
| 2384 '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1)!2;}''', | 2300 '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1)!2;}''', |
| 2385 <String>["1+x1", "2-x2"], | 2301 <String>["1+x1", "2-x2"], |
| 2386 failingTests: '1'); | 2302 failingTests: '1'); |
| 2387 | 2303 |
| 2388 // test arg lists with named params | 2304 // test arg lists with named params |
| 2389 CompletionTestCase.buildTests( | 2305 buildTests( |
| 2390 'test041', | 2306 'test041', |
| 2391 '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1''', | 2307 '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1''', |
| 2392 <String>["1+x1", "1+x2", "1+y"], | 2308 <String>["1+x1", "1+x2", "1+y"], |
| 2393 failingTests: '1'); | 2309 failingTests: '1'); |
| 2394 | 2310 |
| 2395 // test arg lists with named params | 2311 // test arg lists with named params |
| 2396 CompletionTestCase.buildTests( | 2312 buildTests( |
| 2397 'test042', | 2313 'test042', |
| 2398 '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1;!2''', | 2314 '''m(){f(a, b, {x1, x2, y}) {};f(1, 2, !1;!2''', |
| 2399 <String>["1+x1", "1+x2", "2-y"], | 2315 <String>["1+x1", "1+x2", "2-y"], |
| 2400 failingTests: '1'); | 2316 failingTests: '1'); |
| 2401 } | 2317 } |
| 2402 | 2318 |
| 2403 void buildOtherTests() { | 2319 void buildOtherTests() { |
| 2404 CompletionTestCase.buildTests( | 2320 buildTests( |
| 2405 'test_classMembers_inGetter', | 2321 'test_classMembers_inGetter', |
| 2406 '''class A { var fff; get z {ff!1}}''', | 2322 '''class A { var fff; get z {ff!1}}''', |
| 2407 <String>["1+fff"]); | 2323 <String>["1+fff"]); |
| 2408 | 2324 |
| 2409 CompletionTestCase.buildTests( | 2325 buildTests( |
| 2410 'testSingle', | 2326 'testSingle', |
| 2411 '''class A {int x; !2mth() {int y = this.x;}}class B{}''', | 2327 '''class A {int x; !2mth() {int y = this.x;}}class B{}''', |
| 2412 <String>["2+B"]); | 2328 <String>["2+B"]); |
| 2413 } | 2329 } |
| 2330 |
| 2331 /** |
| 2332 * Generate a set of completion tests based on the given [originalSource]. |
| 2333 * |
| 2334 * The source string has completion points embedded in it, which are |
| 2335 * identified by '!X' where X is a single character. Each X is matched to |
| 2336 * positive or negative results in the array of [validationStrings]. |
| 2337 * Validation strings contain the name of a prediction with a two character |
| 2338 * prefix. The first character of the prefix corresponds to an X in the |
| 2339 * [originalSource]. The second character is either a '+' or a '-' indicating |
| 2340 * whether the string is a positive or negative result. |
| 2341 * |
| 2342 * The [originalSource] is the source for a completion test that contains |
| 2343 * completion points. The [validationStrings] are the positive and negative |
| 2344 * predictions. |
| 2345 * |
| 2346 * Optional argument [failingTests], if given, is a string, each character of |
| 2347 * which corresponds to an X in the [originalSource] for which the test is |
| 2348 * expected to fail. This sould be used to mark known completion bugs that |
| 2349 * have not yet been fixed. |
| 2350 */ |
| 2351 void buildTests(String baseName, String originalSource, List<String> results, |
| 2352 {Map<String, String> extraFiles, String failingTests: ''}) { |
| 2353 List<LocationSpec> completionTests = |
| 2354 LocationSpec.from(originalSource, results); |
| 2355 completionTests.sort((LocationSpec first, LocationSpec second) { |
| 2356 return first.id.compareTo(second.id); |
| 2357 }); |
| 2358 if (completionTests.isEmpty) { |
| 2359 test(baseName, () { |
| 2360 fail( |
| 2361 "Expected exclamation point ('!') within the source denoting the" |
| 2362 "position at which code completion should occur"); |
| 2363 }); |
| 2364 } |
| 2365 Set<String> allSpecIds = |
| 2366 completionTests.map((LocationSpec spec) => spec.id).toSet(); |
| 2367 for (String id in failingTests.split('')) { |
| 2368 if (!allSpecIds.contains(id)) { |
| 2369 test("$baseName-$id", () { |
| 2370 fail( |
| 2371 "Test case '$id' included in failingTests, but this id does not ex
ist."); |
| 2372 }); |
| 2373 } |
| 2374 } |
| 2375 for (LocationSpec spec in completionTests) { |
| 2376 if (failingTests.contains(spec.id)) { |
| 2377 ++expectedFailCount; |
| 2378 test("$baseName-${spec.id} (expected failure)", () { |
| 2379 CompletionTestCase test = new CompletionTestCase(); |
| 2380 return new Future(() => test.runTest(spec, extraFiles)).then((_) { |
| 2381 fail('Test passed - expected to fail.'); |
| 2382 }, onError: (_) {}); |
| 2383 }); |
| 2384 } else { |
| 2385 ++expectedPassCount; |
| 2386 test("$baseName-${spec.id}", () { |
| 2387 CompletionTestCase test = new CompletionTestCase(); |
| 2388 return test.runTest(spec, extraFiles); |
| 2389 }); |
| 2390 } |
| 2391 } |
| 2392 } |
| 2414 } | 2393 } |
| OLD | NEW |