MCPcopy Create free account
hub / github.com/SSheldon/rust-objc / test_weak

Function test_weak

src/rc/mod.rs:78–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76
77 #[test]
78 fn test_weak() {
79 let obj = unsafe {
80 StrongPtr::new(msg_send![class!(NSObject), new])
81 };
82 let weak = obj.weak();
83
84 let strong = weak.load();
85 assert!(*strong == *obj);
86 drop(strong);
87
88 drop(obj);
89 assert!(weak.load().is_null());
90 }
91
92 #[test]
93 fn test_weak_copy() {

Callers

nothing calls this directly

Calls 2

weakMethod · 0.80
loadMethod · 0.80

Tested by

no test coverage detected