summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikko Lehtonen <scoopr@iki.fi>2017-03-04 22:12:11 +0200
committerMikko Lehtonen <scoopr@iki.fi>2017-03-04 23:02:38 +0200
commit35159dc4f6decb6d00199aeca8630fbfe8fb5d53 (patch)
tree385954c782cac23a90382ee3932310246e12dbaf
parentbd6fe14d6ac958985576798da47aaaab81180392 (diff)
objc: Whitelisting test
-rw-r--r--tests/expectations/tests/objc_whitelist.rs25
-rw-r--r--tests/headers/objc_whitelist.h22
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/expectations/tests/objc_whitelist.rs b/tests/expectations/tests/objc_whitelist.rs
new file mode 100644
index 00000000..332453f1
--- /dev/null
+++ b/tests/expectations/tests/objc_whitelist.rs
@@ -0,0 +1,25 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+#![cfg(target_os="macos")]
+
+#[macro_use]
+extern crate objc;
+#[allow(non_camel_case_types)]
+pub type id = *mut objc::runtime::Object;
+pub trait protocol_SomeProtocol {
+ unsafe fn protocolMethod(self);
+}
+impl protocol_SomeProtocol for id {
+ unsafe fn protocolMethod(self) { msg_send!(self , protocolMethod) }
+}
+pub trait WhitelistMe {
+ unsafe fn method(self);
+}
+impl WhitelistMe for id {
+ unsafe fn method(self) { msg_send!(self , method) }
+}
+pub trait WhitelistMe_InterestingCategory { }
+impl WhitelistMe_InterestingCategory for id { }
diff --git a/tests/headers/objc_whitelist.h b/tests/headers/objc_whitelist.h
new file mode 100644
index 00000000..7cbe43d6
--- /dev/null
+++ b/tests/headers/objc_whitelist.h
@@ -0,0 +1,22 @@
+// bindgen-flags: --objc-extern-crate --whitelist-type WhitelistMe --whitelist-type WhitelistMe_InterestingCategory -- -x objective-c
+// bindgen-osx-only
+
+
+// Protocol should be included, since it is used by the WhitelistMe
+@protocol SomeProtocol
+-(void)protocolMethod;
+@end
+
+// The whitelisted item
+@interface WhitelistMe <SomeProtocol>
+-(void)method;
+@end
+
+// This was also explicitly whitelisted
+@interface WhitelistMe (InterestingCategory)
+@end
+
+// This was not automatically whitelisted
+@interface WhitelistMe (IgnoredCategory)
+@end
+