Files
sdk/tests/lib_2/isolate/issue_35626_test.dart
T
Liam Appelbe ee32f8c87e [VM] Rehash sets after they are read from a snapshot.
Fixes: https://github.com/dart-lang/sdk/issues/35626
Bug: https://github.com/dart-lang/sdk/issues/35626
Change-Id: I4d5b3799072faf8abb16e9eac15b834dbecce07b
Reviewed-on: https://dart-review.googlesource.com/c/93843
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-02-21 19:39:09 +00:00

34 lines
991 B
Dart

// Copyright (c) 2019, 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.
// Tests that sets of enums can be set through ports.
// https://github.com/dart-lang/sdk/issues/35626
library spawn_tests;
import "dart:io";
import "dart:isolate";
import "package:expect/expect.dart";
enum MyEnum { foo, bar, baz }
void sendSetOfEnums(SendPort port) {
Set<MyEnum> remoteSet = Set()..add(MyEnum.bar);
port.send(remoteSet);
}
void main() async {
Set<MyEnum> localSet = Set()..add(MyEnum.foo)..add(MyEnum.bar);
localSet.lookup(MyEnum.foo);
final port = ReceivePort();
await Isolate.spawn(sendSetOfEnums, port.sendPort);
Set<MyEnum> remoteSet = await port.first;
print(localSet);
print(remoteSet);
Expect.setEquals([MyEnum.bar], localSet.intersection(remoteSet));
Expect.setEquals([MyEnum.bar], remoteSet.intersection(localSet));
}