dart-sdk/tests/ffi/callback_unwind_error_test.dart
Ryan Macnak d2ef2ce26f [ffi] Add failing callback test with an Error that is not an UnhandledException.
Bug: https://github.com/dart-lang/sdk/issues/39487
Change-Id: I54d09341fa4b919e7efe9ea0714c089d2ee91826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299880
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-01 16:13:51 +00:00

28 lines
746 B
Dart

// Copyright (c) 2023, 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.
// SharedObjects=ffi_test_functions
import "dart:ffi";
import "dart:isolate";
import "callback_tests_utils.dart";
typedef SimpleAdditionType = Int32 Function(Int32, Int32);
int simpleAddition(int x, int y) {
print("simpleAddition($x, $y)");
Isolate.current.kill(priority: Isolate.immediate);
return x + y;
}
final testcases = [
CallbackTest("SimpleAddition",
Pointer.fromFunction<SimpleAdditionType>(simpleAddition, 0)),
];
void main() {
testcases.forEach((t) => t.run());
throw "Should not be reached";
}