xref: /third_party/rust/crates/nix/test/test_net.rs (revision 3da5c369)
1use nix::net::if_::*;
2
3#[cfg(any(target_os = "android", target_os = "linux"))]
4const LOOPBACK: &[u8] = b"lo";
5
6#[cfg(not(any(
7    target_os = "android",
8    target_os = "linux",
9    target_os = "haiku"
10)))]
11const LOOPBACK: &[u8] = b"lo0";
12
13#[cfg(target_os = "haiku")]
14const LOOPBACK: &[u8] = b"loop";
15
16#[test]
17fn test_if_nametoindex() {
18    if_nametoindex(LOOPBACK).expect("assertion failed");
19}
20