Added unit test for identify().

This commit is contained in:
Aaron Weiss 2014-10-08 22:20:50 -04:00
parent 6fcf3e2fc6
commit 21136c4ec2

View file

@ -231,4 +231,13 @@ mod test {
b.send_privmsg("#test", "This is a test message.").unwrap(); b.send_privmsg("#test", "This is a test message.").unwrap();
assert_eq!(b.conn.writer().deref_mut().get_ref(), "PRIVMSG #test :This is a test message.\r\n".as_bytes()); assert_eq!(b.conn.writer().deref_mut().get_ref(), "PRIVMSG #test :This is a test message.\r\n".as_bytes());
} }
#[test]
fn identify() {
let w = MemWriter::new();
let c = Connection::new(w, NullReader).unwrap();
let b = IrcBot::from_connection(c, |_, _, _, _| { Ok(()) }).unwrap();
b.identify().unwrap();
assert_eq!(b.conn.writer().deref_mut().get_ref(), "NICK :test\r\nUSER test 0 * :test\r\n".as_bytes());
}
} }