Skip to content

Commit

Permalink
Add a test for dupe enums and namespaces.
Browse files Browse the repository at this point in the history
I feared that this might fail, but it doesn't! :)
  • Loading branch information
emilio committed Jul 30, 2018
1 parent c2e1d1a commit bb283a2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/expectations/tests/dupe-enum-variant-in-namespace.rs
Original file line number Diff line number Diff line change
@@ -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,
}
}
}
10 changes: 10 additions & 0 deletions tests/headers/dupe-enum-variant-in-namespace.h
Original file line number Diff line number Diff line change
@@ -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,
};
}

0 comments on commit bb283a2

Please sign in to comment.