From b44c2f9db11cbd738b4fca27ca33b6fe27c9e4d8 Mon Sep 17 00:00:00 2001 From: Russell Greene Date: Wed, 26 Jan 2022 12:28:08 -0600 Subject: [PATCH] add test for null ptr --- tests/test.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test.rs b/tests/test.rs index 5ba1cc49b..3b5641156 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -297,6 +297,14 @@ fn test_unique_to_shared_ptr_cpp_type() { assert_eq!(&*shared as *const _, ptr); } +#[test] +fn test_unique_to_shared_ptr_null() { + let unique = cxx::UniquePtr::::null(); + assert!(unique.is_null()); + let shared = unique.to_shared(); + assert!(shared.is_null()); +} + #[test] fn test_c_ns_method_calls() { let unique_ptr = ffi2::ns_c_return_unique_ptr_ns();