From bb283a26fad11affbbe55bdb98d349e111e98f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 30 Jul 2018 11:18:23 +0200 Subject: [PATCH] Add a test for dupe enums and namespaces. I feared that this might fail, but it doesn't! :) --- .../tests/dupe-enum-variant-in-namespace.rs | 30 +++++++++++++++++++ .../headers/dupe-enum-variant-in-namespace.h | 10 +++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/expectations/tests/dupe-enum-variant-in-namespace.rs create mode 100644 tests/headers/dupe-enum-variant-in-namespace.h 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 0000000000..b93100b2fa --- /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 0000000000..6d72437dd2 --- /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, + }; +}