Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions bindgen-tests/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,17 @@ macro_rules! test_header {
($function:ident, $header:expr) => {
#[test]
fn $function() {
let tmpdir = tempfile::tempdir().unwrap();
let header = PathBuf::from($header);
let result = create_bindgen_builder(&header).and_then(|builder| {
let check_roundtrip =
env::var_os("BINDGEN_DISABLE_ROUNDTRIP_TEST").is_none();
compare_generated_header(&header, builder, check_roundtrip)
});
let result =
create_bindgen_builder(&header).and_then(|mut builder| {

@emilio emilio Sep 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're panicking anyway below, maybe worth simplifying this to:

let builder = create_bindgen_builder(&header).unwrap();
builder.builder.clang_macro_fallback_build_dir(tmpdir.path());
let check_roundtrip = ...;
compare_generated_header(...).unwrap();

Or so?

But I guess looks good either way.

View changes since the review

builder.builder = builder
.builder
.clang_macro_fallback_build_dir(tmpdir.path());
let check_roundtrip =
env::var_os("BINDGEN_DISABLE_ROUNDTRIP_TEST").is_none();
compare_generated_header(&header, builder, check_roundtrip)
});

if let Err(err) = result {
panic!("{err}");
Expand Down
Loading