()
| 57 | |
| 58 | #[test] |
| 59 | fn test_strong_clone() { |
| 60 | fn retain_count(obj: *mut Object) -> usize { |
| 61 | unsafe { msg_send![obj, retainCount] } |
| 62 | } |
| 63 | |
| 64 | let obj = unsafe { |
| 65 | StrongPtr::new(msg_send![class!(NSObject), new]) |
| 66 | }; |
| 67 | assert!(retain_count(*obj) == 1); |
| 68 | |
| 69 | let cloned = obj.clone(); |
| 70 | assert!(retain_count(*cloned) == 2); |
| 71 | assert!(retain_count(*obj) == 2); |
| 72 | |
| 73 | drop(obj); |
| 74 | assert!(retain_count(*cloned) == 1); |
| 75 | } |
| 76 | |
| 77 | #[test] |
| 78 | fn test_weak() { |