diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-05-24 16:32:56 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-05-24 16:35:36 -0700 |
commit | 05c7fd59c6cf114e12a5617fdfbea5e4d0cdecb4 (patch) | |
tree | 5f5d83e8b266eceabf0788b31e28566f1ebe368f | |
parent | a2c41e5e5e452ab2d8ee69e3db84cfe94031bab0 (diff) |
Improve test pragma parsing
We should take any number of `// bindgen-$whatever` flags at the top of the
file. Only considering the first three lines of the file was confusing when I
tried adding new pragmas with an empty line between the new ones and old ones.
-rw-r--r-- | tests/tests.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 85fcc197..9265b021 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -75,8 +75,12 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> { // Scoop up bindgen-flags from test header let mut flags = Vec::with_capacity(2); - for line in reader.lines().take(3) { + for line in reader.lines() { let line = try!(line); + if !line.starts_with("// bindgen") { + continue; + } + if line.contains("bindgen-flags: ") { let extra_flags = line.split("bindgen-flags: ") .last() |