Skip to content

Commit 731da2f

Browse files
committed
test warning emission
1 parent 5f58560 commit 731da2f

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Diff for: tests/expectations/tests/allowlist_warnings.rs

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: tests/headers/allowlist_warnings.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// bindgen-flags: --allowlist-function "doesnt_match_anything"
2+
int non_matched_function(int arg);

Diff for: tests/tests.rs

+16
Original file line numberDiff line numberDiff line change
@@ -670,3 +670,19 @@ fn dump_preprocessed_input() {
670670
"cpp-empty-layout.hpp is in the preprocessed file"
671671
);
672672
}
673+
674+
#[test]
675+
fn allowlist_warnings() {
676+
let header = concat!(
677+
env!("CARGO_MANIFEST_DIR"),
678+
"/tests/headers/allowlist_warnings.h"
679+
);
680+
681+
let mut bindings = builder()
682+
.header(header)
683+
.allowlist_function("doesnt_match_anything")
684+
.generate()
685+
.expect("unable to generate bindings");
686+
687+
assert_eq!(1, bindings.take_warnings().count());
688+
}

0 commit comments

Comments
 (0)