Skip to content

Commit 35159dc

Browse files
committed
objc: Whitelisting test
1 parent bd6fe14 commit 35159dc

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
#![cfg(target_os="macos")]
7+
8+
#[macro_use]
9+
extern crate objc;
10+
#[allow(non_camel_case_types)]
11+
pub type id = *mut objc::runtime::Object;
12+
pub trait protocol_SomeProtocol {
13+
unsafe fn protocolMethod(self);
14+
}
15+
impl protocol_SomeProtocol for id {
16+
unsafe fn protocolMethod(self) { msg_send!(self , protocolMethod) }
17+
}
18+
pub trait WhitelistMe {
19+
unsafe fn method(self);
20+
}
21+
impl WhitelistMe for id {
22+
unsafe fn method(self) { msg_send!(self , method) }
23+
}
24+
pub trait WhitelistMe_InterestingCategory { }
25+
impl WhitelistMe_InterestingCategory for id { }

tests/headers/objc_whitelist.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// bindgen-flags: --objc-extern-crate --whitelist-type WhitelistMe --whitelist-type WhitelistMe_InterestingCategory -- -x objective-c
2+
// bindgen-osx-only
3+
4+
5+
// Protocol should be included, since it is used by the WhitelistMe
6+
@protocol SomeProtocol
7+
-(void)protocolMethod;
8+
@end
9+
10+
// The whitelisted item
11+
@interface WhitelistMe <SomeProtocol>
12+
-(void)method;
13+
@end
14+
15+
// This was also explicitly whitelisted
16+
@interface WhitelistMe (InterestingCategory)
17+
@end
18+
19+
// This was not automatically whitelisted
20+
@interface WhitelistMe (IgnoredCategory)
21+
@end
22+

0 commit comments

Comments
 (0)