blob: 27c294cf7af5a2c584435e6dc015adb777786069 [file] [log] [blame]
// Copyright (c) 2018, 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.
// VMOptions=--enable-isolate-groups --experimental-enable-isolate-groups-jit
// VMOptions=--no-enable-isolate-groups
import 'dart:isolate';
import 'dart:nativewrappers';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
echo(msg) {
var data = msg[0];
var reply = msg[1];
reply.send('echoing ${data(1)}}');
}
class Test extends NativeFieldWrapperClass2 {
Test(this.i, this.j);
int i, j;
}
main() {
var port = new RawReceivePort();
var obj = new Test(1, 2);
var msg = [obj, port.sendPort];
var snd = Isolate.spawn(echo, msg);
asyncStart();
Future<Isolate?>.value(snd).catchError((e) {
Expect.isTrue(e is ArgumentError);
Expect.isTrue("$e".contains("NativeWrapper"));
port.close();
asyncEnd();
});
}