From 884fe1cd52d0cfecefa95cb4523865bc82b2fede Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 18 Sep 2023 20:29:37 -0700 Subject: [PATCH] Add one test case (more later). --- tests/pure_cpp/smart_holder_poc_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/pure_cpp/smart_holder_poc_test.cpp b/tests/pure_cpp/smart_holder_poc_test.cpp index b0823552f..1bb8461bb 100644 --- a/tests/pure_cpp/smart_holder_poc_test.cpp +++ b/tests/pure_cpp/smart_holder_poc_test.cpp @@ -259,6 +259,14 @@ TEST_CASE("from_unique_ptr_with_deleter+as_lvalue_ref", "[S]") { REQUIRE(hld.as_lvalue_ref() == 19); } +TEST_CASE("from_unique_ptr_with_std_function_deleter+as_lvalue_ref", "[S]") { + std::unique_ptr> orig_owner( + new int(19), [](int *raw_ptr) { delete raw_ptr; }); + auto hld = smart_holder::from_unique_ptr(std::move(orig_owner)); + REQUIRE(orig_owner.get() == nullptr); + REQUIRE(hld.as_lvalue_ref() == 19); +} + TEST_CASE("from_unique_ptr_with_deleter+as_raw_ptr_release_ownership", "[E]") { std::unique_ptr> orig_owner(new int(19)); auto hld = smart_holder::from_unique_ptr(std::move(orig_owner));