diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expectations/tests/objc_blocklist.rs | 42 | ||||
-rw-r--r-- | tests/headers/objc_blocklist.h | 9 |
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/expectations/tests/objc_blocklist.rs b/tests/expectations/tests/objc_blocklist.rs new file mode 100644 index 00000000..7d5d19b0 --- /dev/null +++ b/tests/expectations/tests/objc_blocklist.rs @@ -0,0 +1,42 @@ +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] +#![cfg(target_os = "macos")] + +#[macro_use] +extern crate objc; +#[allow(non_camel_case_types)] +pub type id = *mut objc::runtime::Object; +#[repr(transparent)] +#[derive(Debug, Copy, Clone)] +pub struct SomeClass(pub id); +impl std::ops::Deref for SomeClass { + type Target = objc::runtime::Object; + fn deref(&self) -> &Self::Target { + unsafe { &*self.0 } + } +} +unsafe impl objc::Message for SomeClass {} +impl SomeClass { + pub fn alloc() -> Self { + Self(unsafe { msg_send!(class!(SomeClass), alloc) }) + } +} +impl ISomeClass for SomeClass {} +pub trait ISomeClass: Sized + std::ops::Deref { + unsafe fn ambiguouslyBlockedMethod(&self) + where + <Self as std::ops::Deref>::Target: objc::Message + Sized, + { + msg_send!(*self, ambiguouslyBlockedMethod) + } + unsafe fn instanceMethod(&self) + where + <Self as std::ops::Deref>::Target: objc::Message + Sized, + { + msg_send!(*self, instanceMethod) + } +} diff --git a/tests/headers/objc_blocklist.h b/tests/headers/objc_blocklist.h new file mode 100644 index 00000000..605f2993 --- /dev/null +++ b/tests/headers/objc_blocklist.h @@ -0,0 +1,9 @@ +// bindgen-flags: --objc-extern-crate --blocklist-item ISomeClass::class_ambiguouslyBlockedMethod --blocklist-item ISomeClass::blockedInstanceMethod -- -x objective-c +// bindgen-osx-only + +@interface SomeClass ++ (void)ambiguouslyBlockedMethod; +- (void)ambiguouslyBlockedMethod; +- (void)instanceMethod; +- (void)blockedInstanceMethod; +@end |