diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-07-30 11:18:23 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-07-30 11:23:54 +0200 |
commit | bb283a26fad11affbbe55bdb98d349e111e98f62 (patch) | |
tree | c3c95bc44808dd4aa0d9fb576a11983de0aafd96 | |
parent | c2e1d1a387067b61fc55ed5696e428cd03ba79b3 (diff) |
Add a test for dupe enums and namespaces.
I feared that this might fail, but it doesn't! :)
-rw-r--r-- | tests/expectations/tests/dupe-enum-variant-in-namespace.rs | 30 | ||||
-rw-r--r-- | tests/headers/dupe-enum-variant-in-namespace.h | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/expectations/tests/dupe-enum-variant-in-namespace.rs b/tests/expectations/tests/dupe-enum-variant-in-namespace.rs new file mode 100644 index 00000000..b93100b2 --- /dev/null +++ b/tests/expectations/tests/dupe-enum-variant-in-namespace.rs @@ -0,0 +1,30 @@ +/* automatically generated by rust-bindgen */ + +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] + +#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod foo { + #[allow(unused_imports)] + use self::super::super::root; + impl root::foo::Bar { + pub const Foo1: root::foo::Bar = Bar::Foo; + } + impl root::foo::Bar { + pub const Foo3: root::foo::Bar = Bar::Foo2; + } + #[repr(u32)] + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] + pub enum Bar { + Foo = 0, + Foo2 = 1, + } + } +} diff --git a/tests/headers/dupe-enum-variant-in-namespace.h b/tests/headers/dupe-enum-variant-in-namespace.h new file mode 100644 index 00000000..6d72437d --- /dev/null +++ b/tests/headers/dupe-enum-variant-in-namespace.h @@ -0,0 +1,10 @@ +// bindgen-flags: --rustified-enum ".*" --enable-cxx-namespaces -- -x c++ + +namespace foo { + enum class Bar : unsigned { + Foo = 0, + Foo1 = 0, + Foo2, + Foo3 = Foo2, + }; +} |