From 21136c4ec27113d66f4fd07a4c76ec5a2be446e0 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Wed, 8 Oct 2014 22:20:50 -0400 Subject: [PATCH] Added unit test for identify(). --- src/bot.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bot.rs b/src/bot.rs index 6bfa384..e9cdb64 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -231,4 +231,13 @@ mod test { 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()); } + + #[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()); + } }