summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@gmail.com>2018-04-04 11:47:24 -0800
committerM Farkas-Dyck <strake888@gmail.com>2018-04-04 11:47:24 -0800
commit7c5b2e611429814eff08f0e165c5b732eac1fb02 (patch)
tree03f8d8bb72ae9a9312d5e8654a8ab053770eed37
parent0ada9427e9e2b995da44195d8a49fcbfadb140fb (diff)
test associated consts
-rw-r--r--tests/expectations/tests/bitfield-enum-basic.rs48
-rw-r--r--tests/expectations/tests/enum-doc-bitfield.rs42
-rw-r--r--tests/expectations/tests/issue-1198-alias-rust-bitfield-enum.rs24
3 files changed, 81 insertions, 33 deletions
diff --git a/tests/expectations/tests/bitfield-enum-basic.rs b/tests/expectations/tests/bitfield-enum-basic.rs
index 091dc70b..00752b03 100644
--- a/tests/expectations/tests/bitfield-enum-basic.rs
+++ b/tests/expectations/tests/bitfield-enum-basic.rs
@@ -2,10 +2,18 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-pub const Foo_Bar: Foo = Foo(2);
-pub const Foo_Baz: Foo = Foo(4);
-pub const Foo_Duplicated: Foo = Foo(4);
-pub const Foo_Negative: Foo = Foo(-3);
+impl Foo {
+ pub const Bar: Foo = Foo(2);
+}
+impl Foo {
+ pub const Baz: Foo = Foo(4);
+}
+impl Foo {
+ pub const Duplicated: Foo = Foo(4);
+}
+impl Foo {
+ pub const Negative: Foo = Foo(-3);
+}
impl ::std::ops::BitOr<Foo> for Foo {
type Output = Self;
#[inline]
@@ -35,10 +43,18 @@ impl ::std::ops::BitAndAssign for Foo {
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Foo(pub i32);
-pub const Buz_Bar: Buz = Buz(2);
-pub const Buz_Baz: Buz = Buz(4);
-pub const Buz_Duplicated: Buz = Buz(4);
-pub const Buz_Negative: Buz = Buz(-3);
+impl Buz {
+ pub const Bar: Buz = Buz(2);
+}
+impl Buz {
+ pub const Baz: Buz = Buz(4);
+}
+impl Buz {
+ pub const Duplicated: Buz = Buz(4);
+}
+impl Buz {
+ pub const Negative: Buz = Buz(-3);
+}
impl ::std::ops::BitOr<Buz> for Buz {
type Output = Self;
#[inline]
@@ -68,8 +84,12 @@ impl ::std::ops::BitAndAssign for Buz {
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Buz(pub i8);
-pub const NS_FOO: _bindgen_ty_1 = _bindgen_ty_1(1);
-pub const NS_BAR: _bindgen_ty_1 = _bindgen_ty_1(2);
+impl _bindgen_ty_1 {
+ pub const NS_FOO: _bindgen_ty_1 = _bindgen_ty_1(1);
+}
+impl _bindgen_ty_1 {
+ pub const NS_BAR: _bindgen_ty_1 = _bindgen_ty_1(2);
+}
impl ::std::ops::BitOr<_bindgen_ty_1> for _bindgen_ty_1 {
type Output = Self;
#[inline]
@@ -104,8 +124,12 @@ pub struct _bindgen_ty_1(pub u32);
pub struct Dummy {
pub _address: u8,
}
-pub const Dummy_DUMMY_FOO: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(1);
-pub const Dummy_DUMMY_BAR: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(2);
+impl Dummy__bindgen_ty_1 {
+ pub const DUMMY_FOO: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(1);
+}
+impl Dummy__bindgen_ty_1 {
+ pub const DUMMY_BAR: Dummy__bindgen_ty_1 = Dummy__bindgen_ty_1(2);
+}
impl ::std::ops::BitOr<Dummy__bindgen_ty_1> for Dummy__bindgen_ty_1 {
type Output = Self;
#[inline]
diff --git a/tests/expectations/tests/enum-doc-bitfield.rs b/tests/expectations/tests/enum-doc-bitfield.rs
index 081b39ec..93d1f5f0 100644
--- a/tests/expectations/tests/enum-doc-bitfield.rs
+++ b/tests/expectations/tests/enum-doc-bitfield.rs
@@ -2,21 +2,33 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/// Document field with three slashes
-pub const B_VAR_A: B = B(0);
-/// Document field with preceeding star
-pub const B_VAR_B: B = B(1);
-/// Document field with preceeding exclamation
-pub const B_VAR_C: B = B(2);
-/// < Document field with following star
-pub const B_VAR_D: B = B(3);
-/// < Document field with following exclamation
-pub const B_VAR_E: B = B(4);
-/// Document field with preceeding star, with a loong long multiline
-/// comment.
-///
-/// Very interesting documentation, definitely.
-pub const B_VAR_F: B = B(5);
+impl B {
+ /// Document field with three slashes
+ pub const VAR_A: B = B(0);
+}
+impl B {
+ /// Document field with preceeding star
+ pub const VAR_B: B = B(1);
+}
+impl B {
+ /// Document field with preceeding exclamation
+ pub const VAR_C: B = B(2);
+}
+impl B {
+ /// < Document field with following star
+ pub const VAR_D: B = B(3);
+}
+impl B {
+ /// < Document field with following exclamation
+ pub const VAR_E: B = B(4);
+}
+impl B {
+ /// Document field with preceeding star, with a loong long multiline
+ /// comment.
+ ///
+ /// Very interesting documentation, definitely.
+ pub const VAR_F: B = B(5);
+}
impl ::std::ops::BitOr<B> for B {
type Output = Self;
#[inline]
diff --git a/tests/expectations/tests/issue-1198-alias-rust-bitfield-enum.rs b/tests/expectations/tests/issue-1198-alias-rust-bitfield-enum.rs
index aa836077..8c70625e 100644
--- a/tests/expectations/tests/issue-1198-alias-rust-bitfield-enum.rs
+++ b/tests/expectations/tests/issue-1198-alias-rust-bitfield-enum.rs
@@ -2,9 +2,15 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-pub const MyDupeEnum_A: MyDupeEnum = MyDupeEnum(0);
-pub const MyDupeEnum_A_alias: MyDupeEnum = MyDupeEnum(0);
-pub const MyDupeEnum_B: MyDupeEnum = MyDupeEnum(1);
+impl MyDupeEnum {
+ pub const A: MyDupeEnum = MyDupeEnum(0);
+}
+impl MyDupeEnum {
+ pub const A_alias: MyDupeEnum = MyDupeEnum(0);
+}
+impl MyDupeEnum {
+ pub const B: MyDupeEnum = MyDupeEnum(1);
+}
impl ::std::ops::BitOr<MyDupeEnum> for MyDupeEnum {
type Output = Self;
#[inline]
@@ -34,9 +40,15 @@ impl ::std::ops::BitAndAssign for MyDupeEnum {
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct MyDupeEnum(pub u32);
-pub const MyOtherDupeEnum_C: MyOtherDupeEnum = MyOtherDupeEnum(0);
-pub const MyOtherDupeEnum_C_alias: MyOtherDupeEnum = MyOtherDupeEnum(0);
-pub const MyOtherDupeEnum_D: MyOtherDupeEnum = MyOtherDupeEnum(1);
+impl MyOtherDupeEnum {
+ pub const C: MyOtherDupeEnum = MyOtherDupeEnum(0);
+}
+impl MyOtherDupeEnum {
+ pub const C_alias: MyOtherDupeEnum = MyOtherDupeEnum(0);
+}
+impl MyOtherDupeEnum {
+ pub const D: MyOtherDupeEnum = MyOtherDupeEnum(1);
+}
impl ::std::ops::BitOr<MyOtherDupeEnum> for MyOtherDupeEnum {
type Output = Self;
#[inline]