summaryrefslogtreecommitdiff
path: root/test/test_net.rs
diff options
context:
space:
mode:
authorKamal Marhubi <kamal@marhubi.com>2016-01-27 16:36:07 -0500
committerKamal Marhubi <kamal@marhubi.com>2016-01-27 17:18:58 -0500
commitbeec2f444312b535cde5eafbebe11fe6d28d0717 (patch)
tree90feb9d6382ece14fff9b1fdb4e63b8ebc4f1b57 /test/test_net.rs
parent44098d95663abb5e1386ef1953758e6cccbef3fb (diff)
downloadnix-beec2f444312b535cde5eafbebe11fe6d28d0717.zip
Add test for if_nametoindex
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());
+}