From 6014867f41dfcb74aa00688e8e80ec6ed91f5c63 Mon Sep 17 00:00:00 2001 From: Martin Kamleithner Date: Sat, 6 Apr 2024 22:26:32 +0100 Subject: [PATCH] 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; };