Skip to content

Commit 05c7fd5

Browse files
committed
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.
1 parent a2c41e5 commit 05c7fd5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/tests.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
7575
// Scoop up bindgen-flags from test header
7676
let mut flags = Vec::with_capacity(2);
7777

78-
for line in reader.lines().take(3) {
78+
for line in reader.lines() {
7979
let line = try!(line);
80+
if !line.starts_with("// bindgen") {
81+
continue;
82+
}
83+
8084
if line.contains("bindgen-flags: ") {
8185
let extra_flags = line.split("bindgen-flags: ")
8286
.last()

0 commit comments

Comments
 (0)