mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:31:58 +00:00
[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>
This commit is contained in:
parent
ec330b47de
commit
d2ef2ce26f
27
tests/ffi/callback_unwind_error_test.dart
Normal file
27
tests/ffi/callback_unwind_error_test.dart
Normal file
|
@ -0,0 +1,27 @@
|
|||
// 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";
|
||||
}
|
Loading…
Reference in a new issue