summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Egerton <eggyal@gmail.com>2020-06-15 21:53:48 +0100
committerAlan Egerton <eggyal@gmail.com>2020-06-15 21:53:48 +0100
commitac17fc0f98d865d31f6b6a0417d5ce36cb14a6d3 (patch)
treecda1be2cc3a4dd2f6cadc030b18a483523993188
parent8ea945145b6eb45052f51b776ae33e06ddb6e517 (diff)
Refined test to verify type of resulting integer
-rw-r--r--bindgen-integration/build.rs14
-rw-r--r--bindgen-integration/cpp/Test.h1
-rwxr-xr-xbindgen-integration/src/lib.rs6
3 files changed, 16 insertions, 5 deletions
diff --git a/bindgen-integration/build.rs b/bindgen-integration/build.rs
index d106f7cd..f042fe93 100644
--- a/bindgen-integration/build.rs
+++ b/bindgen-integration/build.rs
@@ -60,11 +60,15 @@ impl ParseCallbacks for MacroCallback {
}
}
- fn int_macro(&self, _name: &str, _value: i64) -> Option<IntKind> {
- Some(IntKind::Custom {
- name: "crate::MacroInteger",
- is_signed: true,
- })
+ fn int_macro(&self, name: &str, _value: i64) -> Option<IntKind> {
+ match name {
+ "TESTMACRO_CUSTOMINTKIND_PATH" => Some(IntKind::Custom {
+ name: "crate::MacroInteger",
+ is_signed: true,
+ }),
+
+ _ => None,
+ }
}
}
diff --git a/bindgen-integration/cpp/Test.h b/bindgen-integration/cpp/Test.h
index 1299337b..a20cf4b7 100644
--- a/bindgen-integration/cpp/Test.h
+++ b/bindgen-integration/cpp/Test.h
@@ -5,6 +5,7 @@
#define TESTMACRO_INTEGER 42
#define TESTMACRO_STRING "Hello Preprocessor!"
#define TESTMACRO_STRING_EXPANDED TESTMACRO_STRING
+#define TESTMACRO_CUSTOMINTKIND_PATH 123
#include <cwchar>
diff --git a/bindgen-integration/src/lib.rs b/bindgen-integration/src/lib.rs
index f8791174..45cf9bca 100755
--- a/bindgen-integration/src/lib.rs
+++ b/bindgen-integration/src/lib.rs
@@ -244,3 +244,9 @@ fn test_item_rename() {
member: bindings::bar { foo: 2 },
};
}
+
+#[test]
+fn test_macro_customintkind_path() {
+ let v: &std::any::Any = &bindings::TESTMACRO_CUSTOMINTKIND_PATH;
+ assert!(v.is::<MacroInteger>())
+}