diff options
author | Christian Poveda <christian.poveda@ferrous-systems.com> | 2022-08-12 13:36:16 -0500 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-08-18 18:08:37 +0200 |
commit | c5995bda24d628ddecda8bbe10db9b4415cc973a (patch) | |
tree | 2daf81a616a52739c0b8f7bfa58d156707a8cc84 | |
parent | 15a720bafa435d95cfb4896beeb1140bc0536595 (diff) |
test warning emission
-rw-r--r-- | tests/expectations/tests/allowlist_warnings.rs | 6 | ||||
-rw-r--r-- | tests/headers/allowlist_warnings.h | 2 | ||||
-rw-r--r-- | tests/tests.rs | 16 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/expectations/tests/allowlist_warnings.rs b/tests/expectations/tests/allowlist_warnings.rs new file mode 100644 index 00000000..131dbdf3 --- /dev/null +++ b/tests/expectations/tests/allowlist_warnings.rs @@ -0,0 +1,6 @@ +#![allow( + dead_code, + non_snake_case, + non_camel_case_types, + non_upper_case_globals +)] diff --git a/tests/headers/allowlist_warnings.h b/tests/headers/allowlist_warnings.h new file mode 100644 index 00000000..83c9e259 --- /dev/null +++ b/tests/headers/allowlist_warnings.h @@ -0,0 +1,2 @@ +// bindgen-flags: --allowlist-function "doesnt_match_anything" +int non_matched_function(int arg); diff --git a/tests/tests.rs b/tests/tests.rs index cc64cfdd..7b46df5e 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -670,3 +670,19 @@ fn dump_preprocessed_input() { "cpp-empty-layout.hpp is in the preprocessed file" ); } + +#[test] +fn allowlist_warnings() { + let header = concat!( + env!("CARGO_MANIFEST_DIR"), + "/tests/headers/allowlist_warnings.h" + ); + + let mut bindings = builder() + .header(header) + .allowlist_function("doesnt_match_anything") + .generate() + .expect("unable to generate bindings"); + + assert_eq!(1, bindings.take_warnings().count()); +} |