blob: 9ab9ce356c1f06b829cc5a7cc2d1122d7fcdf264 [file] [log] [blame]
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import "dart:async";
import "dart:io";
import "dart:isolate";
import "package:expect/expect.dart";
class Unsendable {}
Future<void> main(args, message) async {
if (args.contains("child")) {
var sendPort = message as SendPort;
var bad = <String, Unsendable?>{"a": null, "b": null};
Expect.throwsArgumentError(() => sendPort.send(bad));
var good = bad.keys.toList();
sendPort.send(good);
sendPort.send("done");
return;
}
final receivePort = RawReceivePort();
receivePort.handler = (msg) {
if (msg == "done") receivePort.close();
};
await Isolate.spawnUri(
Platform.script, <String>["child"], receivePort.sendPort,
errorsAreFatal: true);
}