summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/test.rs1
-rw-r--r--test/test_net.rs12
2 files changed, 13 insertions, 0 deletions
diff --git a/test/test.rs b/test/test.rs
index 8d0b6f14..b5e9847e 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 00000000..acdaf47a
--- /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());
+}