Add Rust fallible test functions
diff --git a/tests/ffi/tests.cc b/tests/ffi/tests.cc
index 350cd7d..0ec2658 100644
--- a/tests/ffi/tests.cc
+++ b/tests/ffi/tests.cc
@@ -1,5 +1,6 @@
#include "tests/ffi/tests.h"
#include "tests/ffi/lib.rs"
+#include <cstring>
extern "C" void cxx_test_suite_set_correct() noexcept;
extern "C" tests::R *cxx_test_suite_get_box() noexcept;
@@ -126,6 +127,14 @@
r_take_unique_ptr_string(
std::unique_ptr<std::string>(new std::string("2020")));
+ ASSERT(r_try_return_primitive() == 2020);
+ try {
+ r_fail_return_primitive();
+ ASSERT(false);
+ } catch (const rust::Error &e) {
+ ASSERT(std::strcmp(e.what(), "rust error") == 0);
+ }
+
cxx_test_suite_set_correct();
return nullptr;
}