@@ -80,19 +80,25 @@ Future<int> test5CallCompute(int value) {
8080 return compute (test5, value);
8181}
8282
83- Future <void > expectFileSuccessfullyCompletes (String filename) async {
83+ Future <void > expectFileSuccessfullyCompletes (String filename,
84+ [bool unsound = false ]) async {
8485 // Run a Dart script that calls compute().
8586 // The Dart process will terminate only if the script exits cleanly with
8687 // all isolate ports closed.
8788 const FileSystem fs = LocalFileSystem ();
8889 const Platform platform = LocalPlatform ();
8990 final String flutterRoot = platform.environment['FLUTTER_ROOT' ]! ;
90- final String dartPath = fs.path.join (flutterRoot, 'bin' , 'cache' , 'dart-sdk' , 'bin' , 'dart' );
91+ final String dartPath =
92+ fs.path.join (flutterRoot, 'bin' , 'cache' , 'dart-sdk' , 'bin' , 'dart' );
9193 final String packageRoot = fs.path.dirname (fs.path.fromUri (platform.script));
92- final String scriptPath = fs.path.join (packageRoot, 'test' , 'foundation' , filename);
94+ final String scriptPath =
95+ fs.path.join (packageRoot, 'test' , 'foundation' , filename);
96+ final String nullSafetyArg =
97+ unsound ? '--no-sound-null-safety' : '--sound-null-safety' ;
9398
9499 // Enable asserts to also catch potentially invalid assertions.
95- final ProcessResult result = await Process .run (dartPath, < String > ['run' , '--enable-asserts' , scriptPath]);
100+ final ProcessResult result = await Process .run (
101+ dartPath, < String > [nullSafetyArg, 'run' , '--enable-asserts' , scriptPath]);
96102 expect (result.exitCode, 0 );
97103}
98104
@@ -194,7 +200,8 @@ void main() {
194200 expect (await computeInstanceMethod (10 ), 100 );
195201 expect (computeInvalidInstanceMethod (10 ), throwsArgumentError);
196202
197- expect (await compute (testDebugName, null , debugLabel: 'debug_name' ), 'debug_name' );
203+ expect (await compute (testDebugName, null , debugLabel: 'debug_name' ),
204+ 'debug_name' );
198205 expect (await compute (testReturnNull, null ), null );
199206 }, skip: kIsWeb); // [intended] isn't supported on the web.
200207
@@ -203,22 +210,26 @@ void main() {
203210 await expectFileSuccessfullyCompletes ('_compute_caller.dart' );
204211 });
205212 test ('with invalid message' , () async {
206- await expectFileSuccessfullyCompletes ('_compute_caller_invalid_message.dart' );
213+ await expectFileSuccessfullyCompletes (
214+ '_compute_caller_invalid_message.dart' );
207215 });
208216 test ('with valid error' , () async {
209217 await expectFileSuccessfullyCompletes ('_compute_caller.dart' );
210218 });
211219 test ('with invalid error' , () async {
212- await expectFileSuccessfullyCompletes ('_compute_caller_invalid_message.dart' );
220+ await expectFileSuccessfullyCompletes (
221+ '_compute_caller_invalid_message.dart' );
213222 });
214223 }, skip: kIsWeb); // [intended] isn't supported on the web.
215224
216225 group ('compute() works with unsound null safety caller' , () {
217226 test ('returning' , () async {
218- await expectFileSuccessfullyCompletes ('_compute_caller_unsound_null_safety.dart' );
227+ await expectFileSuccessfullyCompletes (
228+ '_compute_caller_unsound_null_safety.dart' , true );
219229 });
220230 test ('erroring' , () async {
221- await expectFileSuccessfullyCompletes ('_compute_caller_unsound_null_safety_error.dart' );
231+ await expectFileSuccessfullyCompletes (
232+ '_compute_caller_unsound_null_safety_error.dart' , true );
222233 });
223234 }, skip: kIsWeb); // [intended] isn't supported on the web.
224235}
0 commit comments