summaryrefslogtreecommitdiff
path: root/test/test_net.rs
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_net.rs')
-rw-r--r--test/test_net.rs12
1 files changed, 12 insertions, 0 deletions
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());
+}