Files
sdk/tests/lib/isolate/stacktrace_message_test.dart
T
Alexander Markov a0f356b1f2 [tests/nnbd] Fix lib/isolate tests for NNBD strong mode
The following tests began passing:
dartk-strong-linux-release-x64:lib/isolate/issue_21398_parent_isolate_test/0 was fixed (RuntimeError -> Pass)
dartk-strong-linux-release-x64:lib/isolate/issue_21398_parent_isolate_test/1 was fixed (RuntimeError -> Pass)
dartk-strong-linux-release-x64:lib/isolate/native_wrapper_message_test/0 was fixed (RuntimeError -> Pass)
dartk-strong-linux-release-x64:lib/isolate/native_wrapper_message_test/1 was fixed (RuntimeError -> Pass)

lib/isolate/stacktrace_message_test didn't start passing, but it now
fails in the same way as it fails on legacy bots.


Change-Id: I8514f9f7e85e27f658ef44c5e167bf3709f3c672
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142401
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-04-03 21:34:27 +00:00

43 lines
1.1 KiB
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";
import "package:async_helper/async_helper.dart";
// Test that StackTrace objects can be sent between isolates spawned from
// the same isolate using Isolate.spawn.
void main() {
asyncStart();
ReceivePort reply = new ReceivePort();
Isolate.spawn(runTest, reply.sendPort);
reply.first.then((pair) {
StackTrace? stack = pair[0];
String stackString = pair[1];
if (stack == null) {
print("Failed to send stack-trace");
print(stackString);
Expect.fail("Sending stack-trace");
}
Expect.equals(stackString, "!$stack");
print(stack);
asyncEnd();
});
}
runTest(SendPort sendport) {
try {
throw 'sorry';
} catch (e, stack) {
try {
sendport.send([stack, "$stack"]);
print("Stacktrace sent");
} catch (e, s) {
print("Stacktrace not sent");
sendport.send([null, "$e\n$s"]);
}
}
}