Skip to content

Commit

Permalink
fixup: simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Jul 24, 2024
1 parent 4937441 commit 00cd05c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ unsafe fn parse_address(family: u8, host: pfsync_state_host) -> Result<SocketAdd
mod tests {
use super::pfsync_state_host;
use crate::{state::parse_address, AddrFamily};

use assert_matches::assert_matches;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr};

#[test]
Expand All @@ -110,7 +108,8 @@ mod tests {

let family = u8::from(AddrFamily::Ipv4);

assert_matches!(unsafe { parse_address(family, host) }, Ok(addr) if addr == SocketAddr::new(EXPECTED_IP.into(), EXPECTED_PORT));
let address = unsafe { parse_address(family, host) }.unwrap();
assert_eq!(address, SocketAddr::new(EXPECTED_IP.into(), EXPECTED_PORT));
}

#[test]
Expand All @@ -124,6 +123,7 @@ mod tests {

let family = u8::from(AddrFamily::Ipv6);

assert_matches!(unsafe { parse_address(family, host) }, Ok(addr) if addr == SocketAddr::new(EXPECTED_IP.into(), EXPECTED_PORT));
let address = unsafe { parse_address(family, host) }.unwrap();
assert_eq!(address, SocketAddr::new(EXPECTED_IP.into(), EXPECTED_PORT));
}
}

0 comments on commit 00cd05c

Please sign in to comment.