diff options
-rw-r--r-- | src/macro.rs | 19 | ||||
-rw-r--r-- | tests/cmath.rs | 7 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/macro.rs b/src/macro.rs index f4a1839c..6f16955a 100644 --- a/src/macro.rs +++ b/src/macro.rs @@ -311,18 +311,13 @@ impl base::MacResult for BindgenResult { } } -#[cfg(test)] -fn make_string_vec(parts: &[&str]) -> Vec<String> { - parts.iter().map(|p| p.to_string()).collect() -} - #[test] fn test_parse_process_args() { - assert_eq!(parse_process_args("a b c"), make_string_vec(["a", "b", "c"])); - assert_eq!(parse_process_args("a \"b\" c"), make_string_vec(["a", "b", "c"])); - assert_eq!(parse_process_args("a \'b\' c"), make_string_vec(["a", "b", "c"])); - assert_eq!(parse_process_args("a \"b c\""), make_string_vec(["a", "b c"])); - assert_eq!(parse_process_args("a \'\"b\"\' c"), make_string_vec(["a", "\"b\"", "c"])); - assert_eq!(parse_process_args("a b\\ c"), make_string_vec(["a", "b c"])); - assert_eq!(parse_process_args("a b c\\"), make_string_vec(["a", "b", "c\\"])); + assert_eq!(parse_process_args("a b c"), vec!("a", "b", "c")); + assert_eq!(parse_process_args("a \"b\" c"), vec!("a", "b", "c")); + assert_eq!(parse_process_args("a \'b\' c"), vec!("a", "b", "c")); + assert_eq!(parse_process_args("a \"b c\""), vec!("a", "b c")); + assert_eq!(parse_process_args("a \'\"b\"\' c"), vec!("a", "\"b\"", "c")); + assert_eq!(parse_process_args("a b\\ c"), vec!("a", "b c")); + assert_eq!(parse_process_args("a b c\\"), vec!("a", "b", "c\\")); } diff --git a/tests/cmath.rs b/tests/cmath.rs index 477184b7..97217c53 100644 --- a/tests/cmath.rs +++ b/tests/cmath.rs @@ -3,15 +3,18 @@ #[phase(plugin)] extern crate bindgen; +extern crate libc; + #[allow(dead_code)] #[allow(non_snake_case)] #[allow(non_camel_case_types)] #[allow(non_upper_case_globals)] pub mod ffi { - bindgen!("math.h", link = "m") + bindgen!("/usr/include/math.h", link = "m") } -fn main() { +#[test] +fn test_floor_is_bound_and_callable() { unsafe { assert_eq!(ffi::floor( 2.7), 2.0); assert_eq!(ffi::floor(-2.7), -3.0); |