Skip to content

Commit beec2f4

Browse files
committed
Add test for if_nametoindex
1 parent 44098d9 commit beec2f4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

test/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ extern crate tempdir;
77
extern crate nix_test as nixtest;
88

99
mod sys;
10+
mod test_net;
1011
mod test_nix_path;
1112
mod test_stat;
1213
mod test_unistd;

test/test_net.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use nix::net::if_::*;
2+
3+
#[cfg(target_os = "linux")]
4+
const LOOPBACK: &'static [u8] = b"lo";
5+
6+
#[cfg(not(target_os = "linux"))]
7+
const LOOPBACK: &'static [u8] = b"lo0";
8+
9+
#[test]
10+
fn test_if_nametoindex() {
11+
assert!(if_nametoindex(&LOOPBACK[..]).is_ok());
12+
}

0 commit comments

Comments
 (0)