Add tests for messages with a leading colon in the suffix

This commit is contained in:
Maxime Augier 2021-05-04 19:35:36 +02:00
parent 0179b46c5d
commit b64a71e2fa

View file

@ -547,4 +547,29 @@ mod test {
let message = "@tag=\\:\\s\\\\\\r\\na :test PRIVMSG #test test\r\n"; let message = "@tag=\\:\\s\\\\\\r\\na :test PRIVMSG #test test\r\n";
assert_eq!(msg, message); assert_eq!(msg, message);
} }
#[test]
fn to_message_with_colon_in_suffix() {
let msg = "PRIVMSG #test ::test"
.parse::<Message>()
.unwrap();
let message = Message {
tags: None,
prefix: None,
command: PRIVMSG("#test".to_string(), ":test".to_string())
};
assert_eq!(msg, message);
}
#[test]
fn to_string_with_colon_in_suffix() {
let msg = Message {
tags: None,
prefix: None,
command: PRIVMSG("#test".to_string(), ":test".to_string()),
}
.to_string();
let message = "PRIVMSG #test ::test\r\n";
assert_eq!(msg, message);
}
} }