File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -368,6 +368,28 @@ mod tests {
368
368
use super :: * ;
369
369
use crate :: rc:: { Allocated , Id , Owned , Shared } ;
370
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
+ }
371
393
372
394
#[ test]
373
395
fn test_macro ( ) {
You can’t perform that action at this time.
0 commit comments