Skip to content

Commit

Permalink
Add test for if_nametoindex
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalmarhubi committed Jan 27, 2016
1 parent 44098d9 commit beec2f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions test/test_net.rs
Original file line number Diff line number Diff line change
@@ -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());
}

0 comments on commit beec2f4

Please sign in to comment.