@@ -42,21 +42,39 @@ class FeatureComputerTest extends AbstractSingleUnitTest {
42
42
}
43
43
}
44
44
45
- Future <void > test_argumentList_first () async {
45
+ Future <void > test_argumentList_named () async {
46
46
await assertContextType ('''
47
- void f(int i, String str , bool b) {}
47
+ void f({ int i, String s , bool b} ) {}
48
48
void g(int j) {
49
- f(^j );
49
+ f(i:^ );
50
50
}
51
51
''' , 'int' );
52
52
}
53
53
54
- @failingTest
55
- Future <void > test_argumentList_implicitFirst () async {
54
+ Future <void > test_argumentList_named2 () async {
56
55
await assertContextType ('''
57
- void f(int i, String str , bool b) {}
56
+ void f({ int i, String s , bool b} ) {}
58
57
void g(int j) {
59
- f(^);
58
+ f(s:^);
59
+ }
60
+ ''' , 'String' );
61
+ }
62
+
63
+ Future <void > test_argumentList_named_with_requiredPositional () async {
64
+ await assertContextType ('''
65
+ void f(String s, {int i}) {}
66
+ void g(int j) {
67
+ f('str', i: ^);
68
+ }
69
+ ''' , 'int' );
70
+ }
71
+
72
+ Future <void >
73
+ test_argumentList_named_with_requiredPositional_defaultValue () async {
74
+ await assertContextType ('''
75
+ void f(String s, {int i = 0}) {}
76
+ void g(int j) {
77
+ f('str', i: ^);
60
78
}
61
79
''' , 'int' );
62
80
}
@@ -70,46 +88,116 @@ void g() {
70
88
''' , null );
71
89
}
72
90
73
- Future <void > test_argumentList_noParameters_whitespage () async {
91
+ Future <void > test_argumentList_noParameters_whitespace () async {
74
92
await assertContextType ('''
75
93
void f() {}
76
94
void g() {
77
- f( ^ );
95
+ f( ^ );
78
96
}
79
97
''' , null );
80
98
}
81
99
82
- @failingTest
83
- Future <void > test_argumentList_secondArg () async {
100
+ Future <void > test_argumentList_noParameters_whitespace_left () async {
84
101
await assertContextType ('''
85
- void f(int i, String str, bool b) {}
102
+ void f() {}
103
+ void g() {
104
+ f( ^);
105
+ }
106
+ ''' , null );
107
+ }
108
+
109
+ Future <void > test_argumentList_noParameters_whitespace_right () async {
110
+ await assertContextType ('''
111
+ void f() {}
112
+ void g() {
113
+ f(^ );
114
+ }
115
+ ''' , null );
116
+ }
117
+
118
+ Future <void > test_argumentList_positional () async {
119
+ await assertContextType ('''
120
+ void f([int i]) {}
86
121
void g(int j) {
87
- f(1, ^);
122
+ f(i: ^);
88
123
}
89
- ''' , 'String' );
124
+ ''' , 'int' );
125
+ }
126
+
127
+ Future <void > test_argumentList_positional_completionInLabel () async {
128
+ await assertContextType ('''
129
+ void f([int i = 2]) {}
130
+ void g(int j) {
131
+ f(^i:);
132
+ }
133
+ ''' , null );
134
+ }
135
+
136
+ Future <void > test_argumentList_positional_completionInLabel2 () async {
137
+ await assertContextType ('''
138
+ void f(String s, bool b, [int i = 2]) {}
139
+ void g(int j) {
140
+ f(i^:);
141
+ }
142
+ ''' , null );
143
+ }
144
+
145
+ Future <void > test_argumentList_positional_whitespace () async {
146
+ await assertContextType ('''
147
+ void f([int i]) {}
148
+ void g(int j) {
149
+ f(i: ^ );
150
+ }
151
+ ''' , 'int' );
90
152
}
91
153
92
- Future <void > test_argumentList_secondArg2 () async {
154
+ Future <void > test_argumentList_positional_with_requiredPositional () async {
155
+ await assertContextType ('''
156
+ void f(String s, bool b, [int i]) {}
157
+ void g(int j) {
158
+ f('', 3, i:^);
159
+ }
160
+ ''' , 'int' );
161
+ }
162
+
163
+ Future <void >
164
+ test_argumentList_positional_with_requiredPositional_defaultValue () async {
165
+ await assertContextType ('''
166
+ void f(String s, bool b, [int i = 2]) {}
167
+ void g(int j) {
168
+ f('', 3, i:^);
169
+ }
170
+ ''' , 'int' );
171
+ }
172
+
173
+ Future <void > test_argumentList_requiredPositional_first () async {
93
174
await assertContextType ('''
94
175
void f(int i, String str, bool b) {}
95
176
void g(int j) {
96
- f(1, w^ );
177
+ f(^j );
97
178
}
98
- ''' , 'String ' );
179
+ ''' , 'int ' );
99
180
}
100
181
101
- @failingTest
102
- Future <void > test_argumentList_thirdArg () async {
182
+ Future <void > test_argumentList_requiredPositional_first_implicit () async {
183
+ await assertContextType ('''
184
+ void f(int i, String str, bool b) {}
185
+ void g() {
186
+ f(^);
187
+ }
188
+ ''' , 'int' );
189
+ }
190
+
191
+ Future <void > test_argumentList_requiredPositional_last () async {
103
192
await assertContextType ('''
104
193
void f(int i, String str, bool b) {}
105
194
void g(int j) {
106
- f(1, '2', ^);
195
+ f(1, '2', t ^);
107
196
}
108
197
''' , 'bool' );
109
198
}
110
199
111
- @failingTest
112
- Future <void > test_argumentList_thirdArg2 () async {
200
+ Future <void > test_argumentList_requiredPositional_last_implicit () async {
113
201
await assertContextType ('''
114
202
void f(int i, String str, bool b, num n) {}
115
203
void g(int j) {
@@ -118,6 +206,33 @@ void g(int j) {
118
206
''' , 'bool' );
119
207
}
120
208
209
+ Future <void > test_argumentList_requiredPositional_middle () async {
210
+ await assertContextType ('''
211
+ void f(int i, String str, bool b) {}
212
+ void g(int j) {
213
+ f(1, w^);
214
+ }
215
+ ''' , 'String' );
216
+ }
217
+
218
+ Future <void > test_argumentList_requiredPositional_middle2 () async {
219
+ await assertContextType ('''
220
+ void f(int i, String str, bool b) {}
221
+ void g(int j) {
222
+ f(1, ^, );
223
+ }
224
+ ''' , 'String' );
225
+ }
226
+
227
+ Future <void > test_argumentList_requiredPositional_middle_implicit () async {
228
+ await assertContextType ('''
229
+ void f(int i, String str, bool b) {}
230
+ void g(int j) {
231
+ f(1, ^ );
232
+ }
233
+ ''' , 'String' );
234
+ }
235
+
121
236
Future <void > test_assertInitializer_with_identifier () async {
122
237
await assertContextType ('''
123
238
class C {
0 commit comments