@@ -48,7 +48,7 @@ void main() {
48
48
userMessages: UserMessages (),
49
49
artifacts: artifacts,
50
50
fileSystem: fileSystem,
51
- flutterRoot: () => 'sdk/flutter' ,
51
+ flutterRoot: () => '/ sdk/flutter' ,
52
52
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Linux' ),
53
53
processManager: FakeProcessManager .list (< FakeCommand > [
54
54
const FakeCommand (
@@ -93,7 +93,7 @@ void main() {
93
93
fileSystem: MemoryFileSystem .test (),
94
94
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Windows' ),
95
95
processManager: FakeProcessManager .empty (),
96
- flutterRoot: () => 'sdk/flutter' ,
96
+ flutterRoot: () => '/ sdk/flutter' ,
97
97
);
98
98
99
99
// gen_snapshot is downloaded on demand, and the doctor should not
@@ -115,14 +115,14 @@ void main() {
115
115
fileSystem: MemoryFileSystem .test (),
116
116
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Windows' ),
117
117
processManager: FakeProcessManager .empty (),
118
- flutterRoot: () => 'sdk/flutter' ,
118
+ flutterRoot: () => '/ sdk/flutter' ,
119
119
);
120
120
121
121
expect (await flutterValidator.validate (), _matchDoctorValidation (
122
122
validationType: ValidationType .partial,
123
123
statusInfo: 'Channel beta, 0.0.0, on Windows, locale en_US.UTF-8' ,
124
124
messages: containsAll (const < ValidationMessage > [
125
- ValidationMessage ('Flutter version 0.0.0 on channel beta at sdk/flutter' ),
125
+ ValidationMessage ('Flutter version 0.0.0 on channel beta at / sdk/flutter' ),
126
126
ValidationMessage .error ('version error' ),
127
127
]),
128
128
));
@@ -152,7 +152,7 @@ void main() {
152
152
fileSystem: fileSystem,
153
153
processManager: FakeProcessManager .any (),
154
154
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Windows' ),
155
- flutterRoot: () => 'sdk/flutter'
155
+ flutterRoot: () => '/ sdk/flutter'
156
156
);
157
157
158
158
expect (await flutterValidator.validate (), _matchDoctorValidation (
@@ -183,7 +183,7 @@ void main() {
183
183
fileSystem: MemoryFileSystem .test (),
184
184
processManager: FakeProcessManager .any (),
185
185
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Linux' ),
186
- flutterRoot: () => 'sdk/flutter' ,
186
+ flutterRoot: () => '/ sdk/flutter' ,
187
187
);
188
188
189
189
expect (await flutterValidator.validate (), _matchDoctorValidation (
@@ -213,15 +213,15 @@ void main() {
213
213
fileSystem: MemoryFileSystem .test (),
214
214
processManager: FakeProcessManager .any (),
215
215
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Linux' ),
216
- flutterRoot: () => 'sdk/flutter' ,
216
+ flutterRoot: () => '/ sdk/flutter' ,
217
217
);
218
218
219
219
expect (await flutterValidator.validate (), _matchDoctorValidation (
220
220
validationType: ValidationType .partial,
221
221
statusInfo: 'Channel unknown, 1.0.0, on Linux, locale en_US.UTF-8' ,
222
222
messages: containsAll (< ValidationMessage > [
223
223
const ValidationMessage .hint (
224
- 'Flutter version 1.0.0 on channel unknown at sdk/flutter\n '
224
+ 'Flutter version 1.0.0 on channel unknown at / sdk/flutter\n '
225
225
'Currently on an unknown channel. Run `flutter channel` to switch to an official channel.\n '
226
226
"If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install."
227
227
),
@@ -246,15 +246,15 @@ void main() {
246
246
fileSystem: MemoryFileSystem .test (),
247
247
processManager: FakeProcessManager .any (),
248
248
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Linux' ),
249
- flutterRoot: () => 'sdk/flutter' ,
249
+ flutterRoot: () => '/ sdk/flutter' ,
250
250
);
251
251
252
252
expect (await flutterValidator.validate (), _matchDoctorValidation (
253
253
validationType: ValidationType .partial,
254
254
statusInfo: 'Channel beta, 0.0.0-unknown, on Linux, locale en_US.UTF-8' ,
255
255
messages: containsAll (< ValidationMessage > [
256
256
const ValidationMessage .hint (
257
- 'Flutter version 0.0.0-unknown on channel beta at sdk/flutter\n '
257
+ 'Flutter version 0.0.0-unknown on channel beta at / sdk/flutter\n '
258
258
'Cannot resolve current version, possibly due to local changes.\n '
259
259
'Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.'
260
260
),
@@ -280,7 +280,7 @@ void main() {
280
280
fileSystem: MemoryFileSystem .test (),
281
281
processManager: FakeProcessManager .any (),
282
282
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Linux' ),
283
- flutterRoot: () => 'sdk/flutter' ,
283
+ flutterRoot: () => '/ sdk/flutter' ,
284
284
);
285
285
286
286
expect (await flutterValidator.validate (), _matchDoctorValidation (
@@ -371,7 +371,7 @@ void main() {
371
371
fileSystem: MemoryFileSystem .test (),
372
372
processManager: FakeProcessManager .any (),
373
373
operatingSystemUtils: FakeOperatingSystemUtils (name: 'Linux' ),
374
- flutterRoot: () => 'sdk/flutter' ,
374
+ flutterRoot: () => '/ sdk/flutter' ,
375
375
);
376
376
377
377
expect (await flutterValidator.validate (), _matchDoctorValidation (
@@ -387,6 +387,7 @@ void main() {
387
387
});
388
388
389
389
testWithoutContext ('detects no flutter and dart on path' , () async {
390
+ const String flutterRoot = 'sdk/flutter' ;
390
391
final FlutterValidator flutterValidator = FlutterValidator (
391
392
platform: FakePlatform (localeName: 'en_US.UTF-8' ),
392
393
flutterVersion: () => FakeFlutterVersion (
@@ -402,14 +403,96 @@ void main() {
402
403
name: 'Linux' ,
403
404
whichLookup: const < String , File > {},
404
405
),
405
- flutterRoot: () => 'sdk/flutter' ,
406
+ flutterRoot: () => flutterRoot ,
406
407
);
407
408
408
409
expect (await flutterValidator.validate (), _matchDoctorValidation (
409
410
validationType: ValidationType .partial,
410
411
statusInfo: 'Channel beta, 1.0.0, on Linux, locale en_US.UTF-8' ,
411
412
messages: contains (const ValidationMessage .hint (
412
- 'The flutter binary is not on your path. Consider adding sdk/flutter/bin to your path.' ,
413
+ 'The flutter binary is not on your path. Consider adding $flutterRoot /bin to your path.' ,
414
+ )),
415
+ ));
416
+ });
417
+
418
+ testWithoutContext ('allows case differences in paths on Windows' , () async {
419
+ const String flutterRoot = r'c:\path\to\flutter-sdk' ;
420
+ const String osName = 'Microsoft Windows' ;
421
+ final MemoryFileSystem fs = MemoryFileSystem .test (
422
+ style: FileSystemStyle .windows,
423
+ );
424
+ // The windows' file system is not case sensitive, so changing the case
425
+ // here should not matter.
426
+ final File flutterBinary = fs.file ('${flutterRoot .toUpperCase ()}\\ bin\\ flutter' )
427
+ ..createSync (recursive: true );
428
+ final FlutterValidator flutterValidator = FlutterValidator (
429
+ platform: FakePlatform (operatingSystem: 'windows' , localeName: 'en_US.UTF-8' ),
430
+ flutterVersion: () => FakeFlutterVersion (
431
+ frameworkVersion: '1.0.0' ,
432
+ channel: 'beta'
433
+ ),
434
+ devToolsVersion: () => '2.8.0' ,
435
+ userMessages: UserMessages (),
436
+ artifacts: Artifacts .test (),
437
+ fileSystem: fs,
438
+ processManager: FakeProcessManager .empty (),
439
+ operatingSystemUtils: FakeOperatingSystemUtils (
440
+ name: osName,
441
+ whichLookup: < String , File > {
442
+ 'flutter' : flutterBinary,
443
+ },
444
+ ),
445
+ flutterRoot: () => flutterRoot,
446
+ );
447
+
448
+ expect (await flutterValidator.validate (), _matchDoctorValidation (
449
+ validationType: ValidationType .partial,
450
+ statusInfo: 'Channel beta, 1.0.0, on $osName , locale en_US.UTF-8' ,
451
+ messages: everyElement (isA <ValidationMessage >().having (
452
+ (ValidationMessage message) => message.message,
453
+ 'message' ,
454
+ isNot (contains ('Warning: `flutter` on your path resolves to' )),
455
+ )),
456
+ ));
457
+ });
458
+
459
+ testWithoutContext ('allows different separator types in paths on Windows' , () async {
460
+ const String flutterRoot = r'c:\path\to\flutter-sdk' ;
461
+ const String osName = 'Microsoft Windows' ;
462
+ final MemoryFileSystem fs = MemoryFileSystem .test (
463
+ style: FileSystemStyle .windows,
464
+ );
465
+ const String filePath = '$flutterRoot \\ bin\\ flutter' ;
466
+ // force posix style path separators
467
+ final File flutterBinary = fs.file (filePath.replaceAll (r'\' , '/' ))
468
+ ..createSync (recursive: true );
469
+ final FlutterValidator flutterValidator = FlutterValidator (
470
+ platform: FakePlatform (operatingSystem: 'windows' , localeName: 'en_US.UTF-8' ),
471
+ flutterVersion: () => FakeFlutterVersion (
472
+ frameworkVersion: '1.0.0' ,
473
+ channel: 'beta'
474
+ ),
475
+ devToolsVersion: () => '2.8.0' ,
476
+ userMessages: UserMessages (),
477
+ artifacts: Artifacts .test (),
478
+ fileSystem: fs,
479
+ processManager: FakeProcessManager .empty (),
480
+ operatingSystemUtils: FakeOperatingSystemUtils (
481
+ name: osName,
482
+ whichLookup: < String , File > {
483
+ 'flutter' : flutterBinary,
484
+ },
485
+ ),
486
+ flutterRoot: () => flutterRoot,
487
+ );
488
+
489
+ expect (await flutterValidator.validate (), _matchDoctorValidation (
490
+ validationType: ValidationType .partial,
491
+ statusInfo: 'Channel beta, 1.0.0, on $osName , locale en_US.UTF-8' ,
492
+ messages: everyElement (isA <ValidationMessage >().having (
493
+ (ValidationMessage message) => message.message,
494
+ 'message' ,
495
+ isNot (contains ('Warning: `flutter` on your path resolves to' )),
413
496
)),
414
497
));
415
498
});
@@ -430,20 +513,20 @@ void main() {
430
513
operatingSystemUtils: FakeOperatingSystemUtils (
431
514
name: 'Linux' ,
432
515
whichLookup: < String , File > {
433
- 'flutter' : fs.file ('/usr/bin/ flutter' )..createSync (recursive: true ),
434
- 'dart' : fs.file ('/usr/bin/dart ' )..createSync (recursive: true ),
516
+ 'flutter' : fs.file ('/sdk/ flutter-beta ' )..createSync (recursive: true ),
517
+ 'dart' : fs.file ('/sdk/flutter-beta ' )..createSync (recursive: true ),
435
518
},
436
519
),
437
- flutterRoot: () => 'sdk/flutter' ,
520
+ flutterRoot: () => '/ sdk/flutter' ,
438
521
);
439
522
440
523
expect (await flutterValidator.validate (), _matchDoctorValidation (
441
524
validationType: ValidationType .partial,
442
525
statusInfo: 'Channel beta, 1.0.0, on Linux, locale en_US.UTF-8' ,
443
526
messages: contains (const ValidationMessage .hint (
444
- 'Warning: `flutter` on your path resolves to /usr/bin/ flutter, which '
445
- 'is not inside your current Flutter SDK checkout at sdk/flutter. '
446
- 'Consider adding sdk/flutter/bin to the front of your path.' ,
527
+ 'Warning: `flutter` on your path resolves to /sdk/ flutter-beta , which '
528
+ 'is not inside your current Flutter SDK checkout at / sdk/flutter. '
529
+ 'Consider adding / sdk/flutter/bin to the front of your path.' ,
447
530
)),
448
531
));
449
532
});
0 commit comments