User idents and hostnames actually can have dots

This commit is contained in:
angelsl 2016-02-07 16:00:35 +08:00
parent 20338f881f
commit 54cb41a616

View file

@ -141,15 +141,31 @@ mod test {
assert_eq!(Message::new(
None, "PING", vec![], Some("data")
).unwrap().source_nickname(), None);
assert_eq!(Message::new(
Some("irc.test.net"), "PING", vec![], Some("data")
).unwrap().source_nickname(), None);
assert_eq!(Message::new(
Some("test!test@test"), "PING", vec![], Some("data")
).unwrap().source_nickname(), Some("test"));
assert_eq!(Message::new(
Some("test@test"), "PING", vec![], Some("data")
).unwrap().source_nickname(), Some("test"));
assert_eq!(Message::new(
Some("test!test@awe.did.you.know.irc.hostnames.have.dots"), "PING", vec![], Some("data")
).unwrap().source_nickname(), Some("test"));
assert_eq!(Message::new(
Some("test!test@127.0.0.1"), "PING", vec![], Some("data")
).unwrap().source_nickname(), Some("test"));
assert_eq!(Message::new(
Some("test@test.com"), "PING", vec![], Some("data")
).unwrap().source_nickname(), Some("test"));
assert_eq!(Message::new(
Some("test"), "PING", vec![], Some("data")
).unwrap().source_nickname(), Some("test"));