We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c454425 commit be80d5fCopy full SHA for be80d5f
objc2/src/macros.rs
@@ -368,6 +368,28 @@ mod tests {
368
use super::*;
369
use crate::rc::{Allocated, Id, Owned, Shared};
370
use crate::runtime::Object;
371
+ use crate::{Encoding, RefEncode};
372
+
373
+ #[repr(C)]
374
+ struct _NSZone {
375
+ _inner: [u8; 0],
376
+ }
377
378
+ unsafe impl RefEncode for _NSZone {
379
+ const ENCODING_REF: Encoding<'static> =
380
+ Encoding::Pointer(&Encoding::Struct("_NSZone", &[]));
381
382
383
+ #[test]
384
+ fn test_macro_alloc() {
385
+ let cls = class!(NSObject);
386
387
+ let _obj: Option<Id<Allocated<Object>, Shared>> = unsafe { msg_send_id![cls, alloc] };
388
389
+ let zone: *const _NSZone = ptr::null();
390
+ let _obj: Option<Id<Allocated<Object>, Owned>> =
391
+ unsafe { msg_send_id![cls, allocWithZone: zone] };
392
393
394
#[test]
395
fn test_macro() {
0 commit comments