diff --git a/test/test.rs b/test/test.rs index 8d0b6f1424..b5e9847e51 100644 --- a/test/test.rs +++ b/test/test.rs @@ -7,6 +7,7 @@ extern crate tempdir; extern crate nix_test as nixtest; mod sys; +mod test_net; mod test_nix_path; mod test_stat; mod test_unistd; diff --git a/test/test_net.rs b/test/test_net.rs new file mode 100644 index 0000000000..acdaf47a86 --- /dev/null +++ b/test/test_net.rs @@ -0,0 +1,12 @@ +use nix::net::if_::*; + +#[cfg(target_os = "linux")] +const LOOPBACK: &'static [u8] = b"lo"; + +#[cfg(not(target_os = "linux"))] +const LOOPBACK: &'static [u8] = b"lo0"; + +#[test] +fn test_if_nametoindex() { + assert!(if_nametoindex(&LOOPBACK[..]).is_ok()); +}