Skip to content

Commit

Permalink
dev: add should_panic expected message to tracker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
da2ce7 committed Sep 5, 2023
1 parent 2fa3742 commit 7adada5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/servers/udp/connection_cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ mod tests {
}

#[test]
#[should_panic]
#[should_panic = "InvalidConnectionId"]
fn it_should_be_not_valid_after_their_last_time_extent() {
let remote_address = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 0);

Expand Down
8 changes: 4 additions & 4 deletions src/tracker/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,14 @@ mod test {
}

#[test]
#[should_panic]
#[should_panic = "assertion `left == right` failed"]
fn should_fail_trying_to_instantiate_from_a_byte_slice_with_less_than_20_bytes() {
let less_than_20_bytes = [0; 19];
let _: peer::Id = peer::Id::from_bytes(&less_than_20_bytes);
}

#[test]
#[should_panic]
#[should_panic = "assertion `left == right` failed"]
fn should_fail_trying_to_instantiate_from_a_byte_slice_with_more_than_20_bytes() {
let more_than_20_bytes = [0; 21];
let _: peer::Id = peer::Id::from_bytes(&more_than_20_bytes);
Expand Down Expand Up @@ -418,13 +418,13 @@ mod test {
}

#[test]
#[should_panic]
#[should_panic = "NotEnoughBytes"]
fn should_fail_trying_to_convert_from_a_byte_vector_with_less_than_20_bytes() {
let _: peer::Id = peer::Id::try_from([0; 19].to_vec()).unwrap();
}

#[test]
#[should_panic]
#[should_panic = "TooManyBytes"]
fn should_fail_trying_to_convert_from_a_byte_vector_with_more_than_20_bytes() {
let _: peer::Id = peer::Id::try_from([0; 21].to_vec()).unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/servers/api/v1/contract/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use torrust_tracker_test_helpers::configuration;
use crate::servers::api::test_environment::stopped_test_environment;

#[tokio::test]
#[should_panic]
#[should_panic = "Could not receive bind_address."]
async fn should_fail_with_ssl_enabled_and_bad_ssl_config() {
let mut test_env = stopped_test_environment(configuration::ephemeral());

Expand Down

0 comments on commit 7adada5

Please sign in to comment.