diff options
author | Travis Finkenauer <tmfinken@gmail.com> | 2020-06-29 01:42:09 -0400 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-06-29 13:25:00 +0200 |
commit | 394648a5f128b7dd2ca2f0e4b06ae4e362c583c9 (patch) | |
tree | 7b4a40cb4002afd85c50f5b6801f768e6f7415ae | |
parent | 3151087a3a3940aef33c4a3d23671a05683c6e85 (diff) |
Simplify multiple headers test
Ensure that we try to generate() the test Builder.
Remove unnecessary reserve() optimization.
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | src/main.rs | 21 |
2 files changed, 5 insertions, 17 deletions
@@ -501,7 +501,6 @@ impl Builder { if self.input_headers.len() > 1 { // To pass more than one header, we need to pass all but the last // header via the `-include` clang arg - output_vector.reserve(2 * self.input_headers.len() - 2); for header in &self.input_headers[..self.input_headers.len() - 1] { output_vector.push("-include".to_string()); output_vector.push(header.clone()); diff --git a/src/main.rs b/src/main.rs index 168d6cc0..5a9c3318 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,25 +102,14 @@ mod test { let flags_str = flags_quoted.join(" "); println!("{}", flags_str); - crate::options::builder_from_flags(command_line_flags.into_iter()) - .unwrap(); + let (builder, _output, _verbose) = + crate::options::builder_from_flags(command_line_flags.into_iter()) + .unwrap(); + builder.generate().expect("failed to generate bindings"); } #[test] - fn commandline_flag_roundtrip() { - // test1: various options - let bindings = bindgen::Builder::default() - .header("tests/headers/char.h") - .record_matches(false) - .size_t_is_usize(true) - .rustfmt_bindings(false) - .rustfmt_configuration_file(Some(PathBuf::from("/dev/null"))) - .no_partialeq(".") - .no_copy(".") - .no_hash("."); - build_flags_output_helper(&bindings); - - // test2: multiple headers + fn commandline_multiple_headers() { let bindings = bindgen::Builder::default() .header("tests/headers/char.h") .header("tests/headers/func_ptr.h") |