Skip to content

Commit

Permalink
tcp/tests: make sure line number in recv_nothing points to the test c…
Browse files Browse the repository at this point in the history
…ode.
  • Loading branch information
Dirbaio committed Dec 29, 2024
1 parent 890c369 commit 502cf01
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2806,11 +2806,14 @@ mod test {
fn recv_nothing(socket: &mut TestSocket, timestamp: Instant) {
socket.cx.set_now(timestamp);

let result: Result<(), ()> = socket
.socket
.dispatch(&mut socket.cx, |_, (_ip_repr, _tcp_repr)| {
let mut fail = false;
let result: Result<(), ()> = socket.socket.dispatch(&mut socket.cx, |_, _| {
fail = true;
Ok(())
});
if fail {
panic!("Should not send a packet")
});
}

assert_eq!(result, Ok(()))
}
Expand All @@ -2833,6 +2836,10 @@ mod test {
$( recv!($socket, Ok($repr)); )*
recv_nothing!($socket)
});
($socket:ident, time $time:expr, [$( $repr:expr ),*]) => ({
$( recv!($socket, time $time, Ok($repr)); )*
recv_nothing!($socket, time $time)
});
($socket:ident, $result:expr) =>
(recv!($socket, time 0, $result));
($socket:ident, time $time:expr, $result:expr) =>
Expand Down

0 comments on commit 502cf01

Please sign in to comment.