From 6014867f41dfcb74aa00688e8e80ec6ed91f5c63 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 6 Apr 2024 22:26:32 +0100 Subject: [PATCH 1/2] chore: fix isolate test that tests sending invalid data, since Dart is much more lenient now --- packages/ferry/test/isolate/isolate_client_test.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/ferry/test/isolate/isolate_client_test.dart b/packages/ferry/test/isolate/isolate_client_test.dart index e5f9d060..cf37fa8b 100644 --- a/packages/ferry/test/isolate/isolate_client_test.dart +++ b/packages/ferry/test/isolate/isolate_client_test.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:isolate'; import 'package:ferry/ferry.dart'; @@ -314,15 +315,17 @@ void main() { _initAutoResponderForReviewsLinkClient, params: null); - void localFunc() {} + final receivePort = ReceivePort(); addTearDown(client.dispose); + addTearDown(receivePort.close); //closure that captures local state, cannot be sent to isolate final invalidMergeReviews = (GReviewsData? previousResult, GReviewsData? fetchMoreResult) { - // try to call this locally declared function - // -> this will make the invalidMergeReviews non-transmittable for sure - localFunc(); + // try to reference receivePort, which is a closure variable + // with native function type, which cannot be sent to isolate + // so sending this function through isolate will throw an error + receivePort.runtimeType; return null; }; From 2ef3320510325e4c67daf4971c17ff4225364d45 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 6 Apr 2024 22:37:31 +0100 Subject: [PATCH 2/2] chore: fix isolate test that tests sending invalid data, since Dart is much more lenient now --- packages/ferry/test/isolate/isolate_client_test.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ferry/test/isolate/isolate_client_test.dart b/packages/ferry/test/isolate/isolate_client_test.dart index cf37fa8b..311fcb2c 100644 --- a/packages/ferry/test/isolate/isolate_client_test.dart +++ b/packages/ferry/test/isolate/isolate_client_test.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:io'; import 'dart:isolate'; import 'package:ferry/ferry.dart';