diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expectations/tests/bitfield-32bit-overflow.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/bitfield_align.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/enum-default-bitfield.rs | 44 | ||||
-rw-r--r-- | tests/expectations/tests/enum-default-consts.rs | 12 | ||||
-rw-r--r-- | tests/expectations/tests/enum-default-module.rs | 14 | ||||
-rw-r--r-- | tests/expectations/tests/enum-default-rust.rs | 15 | ||||
-rw-r--r-- | tests/expectations/tests/issue-739-pointer-wide-bitfield.rs | 2 | ||||
-rw-r--r-- | tests/expectations/tests/struct_with_bitfields.rs | 2 | ||||
-rw-r--r-- | tests/headers/enum-default-bitfield.h | 11 | ||||
-rw-r--r-- | tests/headers/enum-default-consts.h | 11 | ||||
-rw-r--r-- | tests/headers/enum-default-module.h | 11 | ||||
-rw-r--r-- | tests/headers/enum-default-rust.h | 11 |
12 files changed, 129 insertions, 8 deletions
diff --git a/tests/expectations/tests/bitfield-32bit-overflow.rs b/tests/expectations/tests/bitfield-32bit-overflow.rs index f64299a6..7270649e 100644 --- a/tests/expectations/tests/bitfield-32bit-overflow.rs +++ b/tests/expectations/tests/bitfield-32bit-overflow.rs @@ -1,9 +1,7 @@ /* automatically generated by rust-bindgen */ - #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct __BindgenBitfieldUnit<Storage, Align> diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs index d7ee0445..9821aa6f 100644 --- a/tests/expectations/tests/bitfield_align.rs +++ b/tests/expectations/tests/bitfield_align.rs @@ -1,9 +1,7 @@ /* automatically generated by rust-bindgen */ - #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct __BindgenBitfieldUnit<Storage, Align> diff --git a/tests/expectations/tests/enum-default-bitfield.rs b/tests/expectations/tests/enum-default-bitfield.rs new file mode 100644 index 00000000..19172d0b --- /dev/null +++ b/tests/expectations/tests/enum-default-bitfield.rs @@ -0,0 +1,44 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +impl Foo { + pub const Bar: Foo = Foo(0); +} +impl Foo { + pub const Qux: Foo = Foo(1); +} +impl ::std::ops::BitOr<Foo> for Foo { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + Foo(self.0 | other.0) + } +} +impl ::std::ops::BitOrAssign for Foo { + #[inline] + fn bitor_assign(&mut self, rhs: Foo) { + self.0 |= rhs.0; + } +} +impl ::std::ops::BitAnd<Foo> for Foo { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + Foo(self.0 & other.0) + } +} +impl ::std::ops::BitAndAssign for Foo { + #[inline] + fn bitand_assign(&mut self, rhs: Foo) { + self.0 &= rhs.0; + } +} +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct Foo(pub u32); +pub mod Neg { + pub type Type = i32; + pub const MinusOne: Type = -1; + pub const One: Type = 1; +} diff --git a/tests/expectations/tests/enum-default-consts.rs b/tests/expectations/tests/enum-default-consts.rs new file mode 100644 index 00000000..6ced4de0 --- /dev/null +++ b/tests/expectations/tests/enum-default-consts.rs @@ -0,0 +1,12 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +pub const Foo_Bar: Foo = 0; +pub const Foo_Qux: Foo = 1; +pub type Foo = u32; +pub mod Neg { + pub type Type = i32; + pub const MinusOne: Type = -1; + pub const One: Type = 1; +} diff --git a/tests/expectations/tests/enum-default-module.rs b/tests/expectations/tests/enum-default-module.rs new file mode 100644 index 00000000..953793c3 --- /dev/null +++ b/tests/expectations/tests/enum-default-module.rs @@ -0,0 +1,14 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +pub mod Foo { + pub type Type = u32; + pub const Bar: Type = 0; + pub const Qux: Type = 1; +} +pub mod Neg { + pub type Type = i32; + pub const MinusOne: Type = -1; + pub const One: Type = 1; +} diff --git a/tests/expectations/tests/enum-default-rust.rs b/tests/expectations/tests/enum-default-rust.rs new file mode 100644 index 00000000..1400e373 --- /dev/null +++ b/tests/expectations/tests/enum-default-rust.rs @@ -0,0 +1,15 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +#[repr(u32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum Foo { + Bar = 0, + Qux = 1, +} +pub mod Neg { + pub type Type = i32; + pub const MinusOne: Type = -1; + pub const One: Type = 1; +} diff --git a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs index 806b3f16..81c32bbf 100644 --- a/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs +++ b/tests/expectations/tests/issue-739-pointer-wide-bitfield.rs @@ -1,9 +1,7 @@ /* automatically generated by rust-bindgen */ - #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct __BindgenBitfieldUnit<Storage, Align> diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs index 85f37e10..a45472d5 100644 --- a/tests/expectations/tests/struct_with_bitfields.rs +++ b/tests/expectations/tests/struct_with_bitfields.rs @@ -1,9 +1,7 @@ /* automatically generated by rust-bindgen */ - #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] - #[repr(C)] #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct __BindgenBitfieldUnit<Storage, Align> diff --git a/tests/headers/enum-default-bitfield.h b/tests/headers/enum-default-bitfield.h new file mode 100644 index 00000000..a73f2838 --- /dev/null +++ b/tests/headers/enum-default-bitfield.h @@ -0,0 +1,11 @@ +// bindgen-flags: --default-enum-variant=bitfield --constified-enum-module=Neg + +enum Foo { + Bar = 0, + Qux +}; + +enum Neg { + MinusOne = -1, + One = 1, +}; diff --git a/tests/headers/enum-default-consts.h b/tests/headers/enum-default-consts.h new file mode 100644 index 00000000..17f0afc4 --- /dev/null +++ b/tests/headers/enum-default-consts.h @@ -0,0 +1,11 @@ +// bindgen-flags: --default-enum-variant=consts --constified-enum-module=Neg + +enum Foo { + Bar = 0, + Qux +}; + +enum Neg { + MinusOne = -1, + One = 1, +}; diff --git a/tests/headers/enum-default-module.h b/tests/headers/enum-default-module.h new file mode 100644 index 00000000..e586cca2 --- /dev/null +++ b/tests/headers/enum-default-module.h @@ -0,0 +1,11 @@ +// bindgen-flags: --default-enum-variant=moduleconsts --constified-enum-module=Neg + +enum Foo { + Bar = 0, + Qux +}; + +enum Neg { + MinusOne = -1, + One = 1, +}; diff --git a/tests/headers/enum-default-rust.h b/tests/headers/enum-default-rust.h new file mode 100644 index 00000000..797863c3 --- /dev/null +++ b/tests/headers/enum-default-rust.h @@ -0,0 +1,11 @@ +// bindgen-flags: --default-enum-variant=rust --constified-enum-module=Neg + +enum Foo { + Bar = 0, + Qux +}; + +enum Neg { + MinusOne = -1, + One = 1, +}; |