예제 #1
0
파일: MessageTest.cpp 프로젝트: KielBNC/znc
TEST(MessageTest, PrivCTCP) {
	CCTCPMessage msg;
	msg.Parse(":sender PRIVMSG receiver :\001text\001");
	EXPECT_EQ("sender", msg.GetNick().GetNick());
	EXPECT_EQ("PRIVMSG", msg.GetCommand());
	EXPECT_EQ("receiver", msg.GetTarget());
	EXPECT_EQ("text", msg.GetText());
	EXPECT_FALSE(msg.IsReply());
	EXPECT_EQ(CMessage::Type::CTCP, msg.GetType());

	msg.SetText("foo bar");
	EXPECT_EQ("foo bar", msg.GetText());
	EXPECT_EQ(":sender PRIVMSG receiver :\001foo bar\001", msg.ToString());
}
예제 #2
0
파일: MessageTest.cpp 프로젝트: KielBNC/znc
TEST(MessageTest, CTCPReply) {
	CCTCPMessage msg;
	msg.Parse(":sender NOTICE nick :\001FOO bar\001");
	EXPECT_EQ("sender", msg.GetNick().GetNick());
	EXPECT_EQ("NOTICE", msg.GetCommand());
	EXPECT_EQ("nick", msg.GetTarget());
	EXPECT_EQ("FOO bar", msg.GetText());
	EXPECT_TRUE(msg.IsReply());
	EXPECT_EQ(CMessage::Type::CTCP, msg.GetType());

	msg.SetText("BAR foo");
	EXPECT_EQ("BAR foo", msg.GetText());
	EXPECT_EQ(":sender NOTICE nick :\001BAR foo\001", msg.ToString());
}