@@ -27,6 +27,8 @@ const String _androidIntegrationTestFilter =
27
27
'-Pandroid.testInstrumentationRunnerArguments.'
28
28
'notAnnotation=io.flutter.plugins.DartIntegrationTest' ;
29
29
30
+ const String _simulatorDeviceId = '1E76A0FD-38AC-4537-A989-EA639D7D012A' ;
31
+
30
32
final Map <String , dynamic > _kDeviceListMap = < String , dynamic > {
31
33
'runtimes' : < Map <String , dynamic >> [
32
34
< String , dynamic > {
@@ -137,6 +139,7 @@ void main() {
137
139
String platform, {
138
140
String ? destination,
139
141
List <String > extraFlags = const < String > [],
142
+ bool treatWarningsAsErrors = true ,
140
143
}) {
141
144
return ProcessCall (
142
145
'xcrun' ,
@@ -152,7 +155,7 @@ void main() {
152
155
'Debug' ,
153
156
if (destination != null ) ...< String > ['-destination' , destination],
154
157
...extraFlags,
155
- 'GCC_TREAT_WARNINGS_AS_ERRORS=YES' ,
158
+ if (treatWarningsAsErrors) 'GCC_TREAT_WARNINGS_AS_ERRORS=YES' ,
156
159
],
157
160
package.path);
158
161
}
@@ -349,7 +352,7 @@ void main() {
349
352
null ),
350
353
getTargetCheckCall (pluginExampleDirectory, 'ios' ),
351
354
getRunTestCall (pluginExampleDirectory, 'ios' ,
352
- destination: 'id=1E76A0FD-38AC-4537-A989-EA639D7D012A ' ),
355
+ destination: 'id=$ _simulatorDeviceId ' ),
353
356
]));
354
357
});
355
358
});
@@ -1450,6 +1453,98 @@ public class FlutterActivityTest {
1450
1453
getTargetCheckCall (pluginExampleDirectory, 'macos' ),
1451
1454
]));
1452
1455
});
1456
+
1457
+ test ('Xcode warnings exceptions list' , () async {
1458
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
1459
+ platformSupport: < String , PlatformDetails > {
1460
+ platformIOS: const PlatformDetails (PlatformSupport .inline)
1461
+ });
1462
+
1463
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
1464
+
1465
+ processRunner.mockProcessesForExecutable['xcrun' ] = < FakeProcessInfo > [
1466
+ FakeProcessInfo (MockProcess (stdout: jsonEncode (_kDeviceListMap)),
1467
+ < String > ['simctl' , 'list' ]),
1468
+ getMockXcodebuildListProcess (
1469
+ < String > ['RunnerTests' , 'RunnerUITests' ]),
1470
+ ];
1471
+
1472
+ await runCapturingPrint (runner, < String > [
1473
+ 'native-test' ,
1474
+ '--ios' ,
1475
+ '--xcode-warnings-exceptions=plugin'
1476
+ ]);
1477
+
1478
+ expect (
1479
+ processRunner.recordedCalls,
1480
+ contains (
1481
+ getRunTestCall (pluginExampleDirectory, 'ios' ,
1482
+ destination: 'id=$_simulatorDeviceId ' ,
1483
+ treatWarningsAsErrors: false ),
1484
+ ));
1485
+ });
1486
+
1487
+ test ('Xcode warnings exceptions file' , () async {
1488
+ final File configFile = packagesDir.childFile ('exceptions.yaml' );
1489
+ await configFile.writeAsString ('- plugin' );
1490
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
1491
+ platformSupport: < String , PlatformDetails > {
1492
+ platformIOS: const PlatformDetails (PlatformSupport .inline)
1493
+ });
1494
+
1495
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
1496
+
1497
+ processRunner.mockProcessesForExecutable['xcrun' ] = < FakeProcessInfo > [
1498
+ FakeProcessInfo (MockProcess (stdout: jsonEncode (_kDeviceListMap)),
1499
+ < String > ['simctl' , 'list' ]),
1500
+ getMockXcodebuildListProcess (
1501
+ < String > ['RunnerTests' , 'RunnerUITests' ]),
1502
+ ];
1503
+
1504
+ await runCapturingPrint (runner, < String > [
1505
+ 'native-test' ,
1506
+ '--ios' ,
1507
+ '--xcode-warnings-exceptions=${configFile .path }'
1508
+ ]);
1509
+
1510
+ expect (
1511
+ processRunner.recordedCalls,
1512
+ contains (
1513
+ getRunTestCall (pluginExampleDirectory, 'ios' ,
1514
+ destination: 'id=$_simulatorDeviceId ' ,
1515
+ treatWarningsAsErrors: false ),
1516
+ ));
1517
+ });
1518
+
1519
+ test ('treat warnings as errors if plugin not on exceptions list' ,
1520
+ () async {
1521
+ final RepositoryPackage plugin = createFakePlugin ('plugin' , packagesDir,
1522
+ platformSupport: < String , PlatformDetails > {
1523
+ platformIOS: const PlatformDetails (PlatformSupport .inline)
1524
+ });
1525
+
1526
+ final Directory pluginExampleDirectory = getExampleDir (plugin);
1527
+
1528
+ processRunner.mockProcessesForExecutable['xcrun' ] = < FakeProcessInfo > [
1529
+ FakeProcessInfo (MockProcess (stdout: jsonEncode (_kDeviceListMap)),
1530
+ < String > ['simctl' , 'list' ]),
1531
+ getMockXcodebuildListProcess (
1532
+ < String > ['RunnerTests' , 'RunnerUITests' ]),
1533
+ ];
1534
+
1535
+ await runCapturingPrint (runner, < String > [
1536
+ 'native-test' ,
1537
+ '--ios' ,
1538
+ '--xcode-warnings-exceptions=foo,bar'
1539
+ ]);
1540
+
1541
+ expect (
1542
+ processRunner.recordedCalls,
1543
+ contains (
1544
+ getRunTestCall (pluginExampleDirectory, 'ios' ,
1545
+ destination: 'id=$_simulatorDeviceId ' ),
1546
+ ));
1547
+ });
1453
1548
});
1454
1549
1455
1550
group ('multiplatform' , () {
0 commit comments