From fc5708553432ce8cdab09bae562d6533e552e8b5 Mon Sep 17 00:00:00 2001 From: numzero Date: Thu, 7 May 2026 20:53:58 +0300 Subject: [PATCH] add basic tests --- src/ptr.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/ptr.rs b/src/ptr.rs index fdcad87..4633274 100644 --- a/src/ptr.rs +++ b/src/ptr.rs @@ -82,4 +82,30 @@ pub use _to_ptr_own_ref as to_own_ref; #[cfg(test)] mod tests { use super::*; + + #[test] + fn test_ref() { + let obj = "some string".to_string(); + to_own_ref!(obj); + assert_eq!(*obj, "some string"); + } + + #[test] + fn test_mut() { + let obj = b"some string".to_vec(); + to_own_ref!(mut obj); + obj[0] = b'm'; + obj[1] = b'o'; + obj[2] = b'r'; + obj[3] = b'e'; + assert_eq!(*obj, b"more string"); + } + + #[test] + fn test_take() { + let obj = "some string".to_string(); + to_own_ref!(obj); + let s: String = obj.take(); + assert_eq!(s, "some string"); + } }