Skip to content

Commit

Permalink
chore: fix isolate test that tests sending invalid data, since Dart i…
Browse files Browse the repository at this point in the history
…s much more lenient now
  • Loading branch information
knaeckeKami committed Apr 6, 2024
1 parent 3dad149 commit 6014867
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/ferry/test/isolate/isolate_client_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:isolate';

import 'package:ferry/ferry.dart';
Expand Down Expand Up @@ -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;
};

Expand Down

0 comments on commit 6014867

Please sign in to comment.