summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2020-05-12 17:54:17 +0200
committerGitHub <noreply@github.com>2020-05-12 17:54:17 +0200
commitfcc10961dbfe128d2e592cb302316122938d7b58 (patch)
tree169787cd659bcd8c41f801e5342850c62fa00b79 /tests
parentee2f289a2d57e4d67fe38d060f0c93e9ab866183 (diff)
parent1f324cabfc24042903002e1f2cf1530ee8818942 (diff)
Merge pull request #1750 from simlay/objc-inheritance
Objective-c inheritance support
Diffstat (limited to 'tests')
-rw-r--r--tests/expectations/tests/libclang-3.8/objc_inheritance.rs68
-rw-r--r--tests/expectations/tests/libclang-3.9/objc_inheritance.rs68
-rw-r--r--tests/expectations/tests/libclang-4/objc_inheritance.rs68
-rw-r--r--tests/expectations/tests/libclang-5/objc_inheritance.rs68
-rw-r--r--tests/expectations/tests/libclang-9/objc_inheritance.rs68
-rw-r--r--tests/headers/objc_inheritance.h11
6 files changed, 351 insertions, 0 deletions
diff --git a/tests/expectations/tests/libclang-3.8/objc_inheritance.rs b/tests/expectations/tests/libclang-3.8/objc_inheritance.rs
new file mode 100644
index 00000000..5443dd43
--- /dev/null
+++ b/tests/expectations/tests/libclang-3.8/objc_inheritance.rs
@@ -0,0 +1,68 @@
+/* automatically generated by rust-bindgen */
+
+#![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(Clone, Copy)]
+pub struct Foo(pub id);
+impl std::ops::Deref for Foo {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Foo {}
+impl Foo {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ }
+}
+impl IFoo for Foo {}
+pub trait IFoo: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Bar(pub id);
+impl std::ops::Deref for Bar {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Bar {}
+impl Bar {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ }
+}
+impl IFoo for Bar {}
+impl IBar for Bar {}
+pub trait IBar: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Baz(pub id);
+impl std::ops::Deref for Baz {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Baz {}
+impl Baz {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ }
+}
+impl IBar for Baz {}
+impl IFoo for Baz {}
+impl IBaz for Baz {}
+pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/libclang-3.9/objc_inheritance.rs b/tests/expectations/tests/libclang-3.9/objc_inheritance.rs
new file mode 100644
index 00000000..5443dd43
--- /dev/null
+++ b/tests/expectations/tests/libclang-3.9/objc_inheritance.rs
@@ -0,0 +1,68 @@
+/* automatically generated by rust-bindgen */
+
+#![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(Clone, Copy)]
+pub struct Foo(pub id);
+impl std::ops::Deref for Foo {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Foo {}
+impl Foo {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ }
+}
+impl IFoo for Foo {}
+pub trait IFoo: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Bar(pub id);
+impl std::ops::Deref for Bar {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Bar {}
+impl Bar {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ }
+}
+impl IFoo for Bar {}
+impl IBar for Bar {}
+pub trait IBar: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Baz(pub id);
+impl std::ops::Deref for Baz {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Baz {}
+impl Baz {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ }
+}
+impl IBar for Baz {}
+impl IFoo for Baz {}
+impl IBaz for Baz {}
+pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/libclang-4/objc_inheritance.rs b/tests/expectations/tests/libclang-4/objc_inheritance.rs
new file mode 100644
index 00000000..5443dd43
--- /dev/null
+++ b/tests/expectations/tests/libclang-4/objc_inheritance.rs
@@ -0,0 +1,68 @@
+/* automatically generated by rust-bindgen */
+
+#![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(Clone, Copy)]
+pub struct Foo(pub id);
+impl std::ops::Deref for Foo {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Foo {}
+impl Foo {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ }
+}
+impl IFoo for Foo {}
+pub trait IFoo: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Bar(pub id);
+impl std::ops::Deref for Bar {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Bar {}
+impl Bar {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ }
+}
+impl IFoo for Bar {}
+impl IBar for Bar {}
+pub trait IBar: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Baz(pub id);
+impl std::ops::Deref for Baz {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Baz {}
+impl Baz {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ }
+}
+impl IBar for Baz {}
+impl IFoo for Baz {}
+impl IBaz for Baz {}
+pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/libclang-5/objc_inheritance.rs b/tests/expectations/tests/libclang-5/objc_inheritance.rs
new file mode 100644
index 00000000..5443dd43
--- /dev/null
+++ b/tests/expectations/tests/libclang-5/objc_inheritance.rs
@@ -0,0 +1,68 @@
+/* automatically generated by rust-bindgen */
+
+#![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(Clone, Copy)]
+pub struct Foo(pub id);
+impl std::ops::Deref for Foo {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Foo {}
+impl Foo {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ }
+}
+impl IFoo for Foo {}
+pub trait IFoo: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Bar(pub id);
+impl std::ops::Deref for Bar {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Bar {}
+impl Bar {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ }
+}
+impl IFoo for Bar {}
+impl IBar for Bar {}
+pub trait IBar: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Baz(pub id);
+impl std::ops::Deref for Baz {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Baz {}
+impl Baz {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ }
+}
+impl IBar for Baz {}
+impl IFoo for Baz {}
+impl IBaz for Baz {}
+pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/expectations/tests/libclang-9/objc_inheritance.rs b/tests/expectations/tests/libclang-9/objc_inheritance.rs
new file mode 100644
index 00000000..5443dd43
--- /dev/null
+++ b/tests/expectations/tests/libclang-9/objc_inheritance.rs
@@ -0,0 +1,68 @@
+/* automatically generated by rust-bindgen */
+
+#![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(Clone, Copy)]
+pub struct Foo(pub id);
+impl std::ops::Deref for Foo {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Foo {}
+impl Foo {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Foo), alloc) })
+ }
+}
+impl IFoo for Foo {}
+pub trait IFoo: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Bar(pub id);
+impl std::ops::Deref for Bar {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Bar {}
+impl Bar {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Bar), alloc) })
+ }
+}
+impl IFoo for Bar {}
+impl IBar for Bar {}
+pub trait IBar: Sized + std::ops::Deref {}
+#[repr(transparent)]
+#[derive(Clone, Copy)]
+pub struct Baz(pub id);
+impl std::ops::Deref for Baz {
+ type Target = objc::runtime::Object;
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*self.0 }
+ }
+}
+unsafe impl objc::Message for Baz {}
+impl Baz {
+ pub fn alloc() -> Self {
+ Self(unsafe { msg_send!(objc::class!(Baz), alloc) })
+ }
+}
+impl IBar for Baz {}
+impl IFoo for Baz {}
+impl IBaz for Baz {}
+pub trait IBaz: Sized + std::ops::Deref {}
diff --git a/tests/headers/objc_inheritance.h b/tests/headers/objc_inheritance.h
new file mode 100644
index 00000000..8f96e45b
--- /dev/null
+++ b/tests/headers/objc_inheritance.h
@@ -0,0 +1,11 @@
+// bindgen-flags: --objc-extern-crate -- -x objective-c
+// bindgen-osx-only
+
+@interface Foo
+@end
+
+@interface Bar: Foo
+@end
+
+@interface Baz: Bar
+@end