@@ -70,21 +70,21 @@ line 5, column 4: Unrecognized keys: [bob]; supported keys: [sdk, git, path, hos
70
70
}
71
71
72
72
void _hostedDependency () {
73
- test ('null' , () {
74
- final dep = _dependency <HostedDependency >(null );
73
+ test ('null' , () async {
74
+ final dep = await _dependency <HostedDependency >(null );
75
75
expect (dep.version.toString (), 'any' );
76
76
expect (dep.hosted, isNull);
77
77
expect (dep.toString (), 'HostedDependency: any' );
78
78
});
79
79
80
- test ('empty map' , () {
81
- final dep = _dependency <HostedDependency >({});
80
+ test ('empty map' , () async {
81
+ final dep = await _dependency <HostedDependency >({});
82
82
expect (dep.hosted, isNull);
83
83
expect (dep.toString (), 'HostedDependency: any' );
84
84
});
85
85
86
- test ('string version' , () {
87
- final dep = _dependency <HostedDependency >('^1.0.0' );
86
+ test ('string version' , () async {
87
+ final dep = await _dependency <HostedDependency >('^1.0.0' );
88
88
expect (dep.version.toString (), '^1.0.0' );
89
89
expect (dep.hosted, isNull);
90
90
expect (dep.toString (), 'HostedDependency: ^1.0.0' );
@@ -102,15 +102,15 @@ line 4, column 10: Unsupported value for "dep". Could not parse version "not a v
102
102
);
103
103
});
104
104
105
- test ('map w/ just version' , () {
106
- final dep = _dependency <HostedDependency >({'version' : '^1.0.0' });
105
+ test ('map w/ just version' , () async {
106
+ final dep = await _dependency <HostedDependency >({'version' : '^1.0.0' });
107
107
expect (dep.version.toString (), '^1.0.0' );
108
108
expect (dep.hosted, isNull);
109
109
expect (dep.toString (), 'HostedDependency: ^1.0.0' );
110
110
});
111
111
112
- test ('map w/ version and hosted as Map' , () {
113
- final dep = _dependency <HostedDependency >({
112
+ test ('map w/ version and hosted as Map' , () async {
113
+ final dep = await _dependency <HostedDependency >({
114
114
'version' : '^1.0.0' ,
115
115
'hosted' : {'name' : 'hosted_name' , 'url' : 'https://hosted_url' },
116
116
});
@@ -120,8 +120,8 @@ line 4, column 10: Unsupported value for "dep". Could not parse version "not a v
120
120
expect (dep.toString (), 'HostedDependency: ^1.0.0' );
121
121
});
122
122
123
- test ('map /w hosted as a map without name' , () {
124
- final dep = _dependency <HostedDependency >(
123
+ test ('map /w hosted as a map without name' , () async {
124
+ final dep = await _dependency <HostedDependency >(
125
125
{
126
126
'version' : '^1.0.0' ,
127
127
'hosted' : {'url' : 'https://hosted_url' },
@@ -166,8 +166,8 @@ line 10, column 4: Unrecognized keys: [not_supported]; supported keys: [sdk, git
166
166
);
167
167
});
168
168
169
- test ('map w/ version and hosted as String' , () {
170
- final dep = _dependency <HostedDependency >(
169
+ test ('map w/ version and hosted as String' , () async {
170
+ final dep = await _dependency <HostedDependency >(
171
171
{'version' : '^1.0.0' , 'hosted' : 'hosted_url' },
172
172
skipTryPub: true , // todo: Unskip once put supports this
173
173
);
@@ -178,8 +178,8 @@ line 10, column 4: Unrecognized keys: [not_supported]; supported keys: [sdk, git
178
178
expect (dep.toString (), 'HostedDependency: ^1.0.0' );
179
179
});
180
180
181
- test ('map w/ hosted as String' , () {
182
- final dep = _dependency <HostedDependency >({'hosted' : 'hosted_url' });
181
+ test ('map w/ hosted as String' , () async {
182
+ final dep = await _dependency <HostedDependency >({'hosted' : 'hosted_url' });
183
183
expect (dep.version, VersionConstraint .any);
184
184
expect (dep.hosted! .declaredName, isNull);
185
185
expect (dep.hosted! .name, 'dep' );
@@ -199,24 +199,24 @@ line 5, column 4: These keys had `null` values, which is not allowed: [hosted]
199
199
);
200
200
});
201
201
202
- test ('map w/ null version is fine' , () {
203
- final dep = _dependency <HostedDependency >({'version' : null });
202
+ test ('map w/ null version is fine' , () async {
203
+ final dep = await _dependency <HostedDependency >({'version' : null });
204
204
expect (dep.version, VersionConstraint .any);
205
205
expect (dep.hosted, isNull);
206
206
expect (dep.toString (), 'HostedDependency: any' );
207
207
});
208
208
}
209
209
210
210
void _sdkDependency () {
211
- test ('without version' , () {
212
- final dep = _dependency <SdkDependency >({'sdk' : 'flutter' });
211
+ test ('without version' , () async {
212
+ final dep = await _dependency <SdkDependency >({'sdk' : 'flutter' });
213
213
expect (dep.sdk, 'flutter' );
214
214
expect (dep.version, VersionConstraint .any);
215
215
expect (dep.toString (), 'SdkDependency: flutter' );
216
216
});
217
217
218
- test ('with version' , () {
219
- final dep = _dependency <SdkDependency >(
218
+ test ('with version' , () async {
219
+ final dep = await _dependency <SdkDependency >(
220
220
{'sdk' : 'flutter' , 'version' : '>=1.2.3 <2.0.0' },
221
221
);
222
222
expect (dep.sdk, 'flutter' );
@@ -240,29 +240,30 @@ void _sdkDependency() {
240
240
}
241
241
242
242
void _gitDependency () {
243
- test ('string' , () {
244
- final dep = _dependency <GitDependency >({'git' : 'url' });
243
+ test ('string' , () async {
244
+ final dep = await _dependency <GitDependency >({'git' : 'url' });
245
245
expect (dep.url.toString (), 'url' );
246
246
expect (dep.path, isNull);
247
247
expect (dep.ref, isNull);
248
248
expect (dep.toString (), 'GitDependency: url@url' );
249
249
});
250
250
251
- test ('string with version key is ignored' , () {
251
+ test ('string with version key is ignored' , () async {
252
252
// Regression test for https://github.com/dart-lang/pubspec_parse/issues/13
253
- final dep = _dependency <GitDependency >({'git' : 'url' , 'version' : '^1.2.3' });
253
+ final dep =
254
+ await _dependency <GitDependency >({'git' : 'url' , 'version' : '^1.2.3' });
254
255
expect (dep.url.toString (), 'url' );
255
256
expect (dep.path, isNull);
256
257
expect (dep.ref, isNull);
257
258
expect (dep.toString (), 'GitDependency: url@url' );
258
259
});
259
260
260
- test ('string with user@ URL' , () {
261
+ test ('string with user@ URL' , () async {
261
262
final skipTryParse = Platform .environment.containsKey ('TRAVIS' );
262
263
if (skipTryParse) {
263
264
print ('FYI: not validating git@ URI on travis due to failure' );
264
265
}
265
- final dep = _dependency <GitDependency >(
266
+ final dep = await _dependency <GitDependency >(
266
267
{'git' : 'git@localhost:dep.git' },
267
268
skipTryPub: skipTryParse,
268
269
);
@@ -284,8 +285,8 @@ line 6, column 4: Unrecognized keys: [bob]; supported keys: [sdk, git, path, hos
284
285
);
285
286
});
286
287
287
- test ('map' , () {
288
- final dep = _dependency <GitDependency >({
288
+ test ('map' , () async {
289
+ final dep = await _dependency <GitDependency >({
289
290
'git' : {'url' : 'url' , 'path' : 'path' , 'ref' : 'ref' },
290
291
});
291
292
expect (dep.url.toString (), 'url' );
@@ -349,15 +350,16 @@ line 5, column 11: Unsupported value for "git". Must be a String or a Map.
349
350
}
350
351
351
352
void _pathDependency () {
352
- test ('valid' , () {
353
- final dep = _dependency <PathDependency >({'path' : '../path' });
353
+ test ('valid' , () async {
354
+ final dep = await _dependency <PathDependency >({'path' : '../path' });
354
355
expect (dep.path, '../path' );
355
356
expect (dep.toString (), 'PathDependency: path@../path' );
356
357
});
357
358
358
- test ('valid with version key is ignored' , () {
359
- final dep =
360
- _dependency <PathDependency >({'path' : '../path' , 'version' : '^1.2.3' });
359
+ test ('valid with version key is ignored' , () async {
360
+ final dep = await _dependency <PathDependency >(
361
+ {'path' : '../path' , 'version' : '^1.2.3' },
362
+ );
361
363
expect (dep.path, '../path' );
362
364
expect (dep.toString (), 'PathDependency: path@../path' );
363
365
});
@@ -423,11 +425,11 @@ void _expectThrowsContaining(Object content, String errorText) {
423
425
);
424
426
}
425
427
426
- T _dependency <T extends Dependency >(
428
+ Future < T > _dependency <T extends Dependency >(
427
429
Object ? content, {
428
430
bool skipTryPub = false ,
429
- }) {
430
- final value = parse (
431
+ }) async {
432
+ final value = await parse (
431
433
{
432
434
...defaultPubspec,
433
435
'dependencies' : {'dep' : content},
0 commit comments