dart-sdk/tests/lib/isolate/stacktrace_message_test.dart
Martin Kustermann b7909e132a [vm/concurrency] Allow StackTrace objects to be shared
The existing lib/isolate/stacktrace_message_test was failing and also
incorrectly written due to "!" in front of the expected stringification
of the stacktrace.

Issue https://github.com/dart-lang/sdk/issues/46623

TEST=vm/dart{,_2}/isolates/fast_object_copy2_test, lib{,_2}/isolate/stacktrace_message_test

Change-Id: I169d8fd7a7c3cb3b8c57e00287565e3a5c622acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216041
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-10-11 09:01:44 +00:00

29 lines
795 B
Dart

// Copyright (c) 2013, 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:isolate';
import "package:expect/expect.dart";
// Test that StackTrace objects can be sent between isolates spawned from
// the same isolate using Isolate.spawn.
void main() async {
final reply = ReceivePort();
Isolate.spawn(runTest, reply.sendPort);
final pair = await reply.first;
final stack = pair[0] as StackTrace;
final stackString = pair[1] as String;
Expect.isNotNull(stack);
Expect.equals(stackString, "$stack");
}
runTest(SendPort sendport) {
try {
throw 'sorry';
} catch (e, stack) {
sendport.send([stack, "$stack"]);
}
}