diff -r 19927b70588c -r 7c8697fa019f rust/hedgewars-network-protocol/src/tests/parser.rs --- a/rust/hedgewars-network-protocol/src/tests/parser.rs Sun Mar 24 14:34:27 2024 -0400 +++ b/rust/hedgewars-network-protocol/src/tests/parser.rs Mon Mar 25 00:04:13 2024 +0300 @@ -1,12 +1,22 @@ use crate::{ parser::HwProtocolError, - parser::{message, server_message}, + parser::{malformed_message, message, server_message}, types::GameCfg, }; #[test] fn parse_test() { use crate::messages::HwProtocolMessage::*; + use nom::Err::Incomplete; + + assert!(matches!( + dbg!(message(b"CHAT\nWhat the")), + Err(Incomplete(_)) + )); + assert!(matches!( + dbg!(malformed_message(b"CHAT\nWhat the \xF0\x9F\xA6\x94\n\nBYE")), + Ok((b"BYE", _)) + )); assert_eq!(message(b"PING\n\n"), Ok((&b""[..], Ping))); assert_eq!(message(b"START_GAME\n\n"), Ok((&b""[..], StartGame)));