Implement returning unique_ptr from Rust to C++
diff --git a/tests/ffi/tests.cc b/tests/ffi/tests.cc
index 3d30ebe..245cfbe 100644
--- a/tests/ffi/tests.cc
+++ b/tests/ffi/tests.cc
@@ -90,6 +90,10 @@
}
}
+extern "C" C *cxx_test_suite_get_unique_ptr() {
+ return std::unique_ptr<C>(new C{2020}).release();
+}
+
extern "C" const char *cxx_run_test() noexcept {
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
@@ -103,6 +107,7 @@
ASSERT(r_return_primitive() == 2020);
ASSERT(r_return_shared().z == 2020);
ASSERT(cxx_test_suite_r_is_correct(&*r_return_box()));
+ ASSERT(r_return_unique_ptr()->get() == 2020);
ASSERT(r_return_ref(Shared{2020}) == 2020);
ASSERT(std::string(r_return_str(Shared{2020})) == "2020");
ASSERT(std::string(r_return_rust_string()) == "2020");