Skip to content

Commit

Permalink
Add tests for messages with a leading colon in the suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
maugier committed May 4, 2021
1 parent 0179b46 commit b64a71e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions irc-proto/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,4 +547,29 @@ mod test {
let message = "@tag=\\:\\s\\\\\\r\\na :test PRIVMSG #test test\r\n";
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);
}
}

0 comments on commit b64a71e

Please sign in to comment.