Add clang-format configuration.

For now, it uses tabs like before, to make the diff easier to read/check.
One of following commits will switch it to spaces.
This commit is contained in:
Alexey Sokolov
2015-12-06 22:36:35 +00:00
parent 02f8749a8b
commit 33b0627d75
132 changed files with 12743 additions and 8904 deletions

View File

@@ -20,29 +20,36 @@
TEST(IRC32, GetMessageTags) {
EXPECT_EQ(MCString(), CUtils::GetMessageTags(""));
EXPECT_EQ(MCString(), CUtils::GetMessageTags(":nick!ident@host PRIVMSG #chan :hello world"));
EXPECT_EQ(MCString(), CUtils::GetMessageTags(
":nick!ident@host PRIVMSG #chan :hello world"));
MCString exp = { {"a","b"} };
MCString exp = {{"a", "b"}};
EXPECT_EQ(exp, CUtils::GetMessageTags("@a=b"));
EXPECT_EQ(exp, CUtils::GetMessageTags("@a=b :nick!ident@host PRIVMSG #chan :hello world"));
EXPECT_EQ(exp, CUtils::GetMessageTags(
"@a=b :nick!ident@host PRIVMSG #chan :hello world"));
EXPECT_EQ(exp, CUtils::GetMessageTags("@a=b :rest"));
exp.clear();
exp = { {"ab","cdef"}, {"znc.in/gh-ij","klmn,op"} };
EXPECT_EQ(exp, CUtils::GetMessageTags("@ab=cdef;znc.in/gh-ij=klmn,op :rest"));
exp = {{"ab", "cdef"}, {"znc.in/gh-ij", "klmn,op"}};
EXPECT_EQ(exp,
CUtils::GetMessageTags("@ab=cdef;znc.in/gh-ij=klmn,op :rest"));
exp = { {"a","==b=="} };
exp = {{"a", "==b=="}};
EXPECT_EQ(exp, CUtils::GetMessageTags("@a===b== :rest"));
exp.clear();
exp = { {"a",""}, {"b","c"}, {"d",""} };
exp = {{"a", ""}, {"b", "c"}, {"d", ""}};
EXPECT_EQ(exp, CUtils::GetMessageTags("@a;b=c;d :rest"));
exp = { {"semi-colon",";"}, {"space"," "}, {"NUL",{'\0'}}, {"backslash","\\"}, {"CR",{'\r'}}, {"LF",{'\n'}} };
EXPECT_EQ(exp, CUtils::GetMessageTags(R"(@semi-colon=\:;space=\s;NUL=\0;backslash=\\;CR=\r;LF=\n :rest)"));
exp = {{"semi-colon", ";"}, {"space", " "}, {"NUL", {'\0'}},
{"backslash", "\\"}, {"CR", {'\r'}}, {"LF", {'\n'}}};
EXPECT_EQ(
exp,
CUtils::GetMessageTags(
R"(@semi-colon=\:;space=\s;NUL=\0;backslash=\\;CR=\r;LF=\n :rest)"));
exp.clear();
exp = { {"a","; \\\r\n"} };
exp = {{"a", "; \\\r\n"}};
EXPECT_EQ(exp, CUtils::GetMessageTags(R"(@a=\:\s\\\r\n :rest)"));
exp.clear();
}
@@ -54,23 +61,26 @@ TEST(IRC32, SetMessageTags) {
CUtils::SetMessageTags(sLine, MCString());
EXPECT_EQ(":rest", sLine);
MCString tags = { {"a","b"} };
MCString tags = {{"a", "b"}};
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ("@a=b :rest", sLine);
tags = { {"a","b"}, {"c","d"} };
tags = {{"a", "b"}, {"c", "d"}};
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ("@a=b;c=d :rest", sLine);
tags = { {"a","b"}, {"c","d"}, {"e",""} };
tags = {{"a", "b"}, {"c", "d"}, {"e", ""}};
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ("@a=b;c=d;e :rest", sLine);
tags = { {"semi-colon",";"}, {"space"," "}, {"NUL",{'\0'}}, {"backslash","\\"}, {"CR",{'\r'}}, {"LF",{'\n'}} };
tags = {{"semi-colon", ";"}, {"space", " "}, {"NUL", {'\0'}},
{"backslash", "\\"}, {"CR", {'\r'}}, {"LF", {'\n'}}};
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ(R"(@CR=\r;LF=\n;NUL=\0;backslash=\\;semi-colon=\:;space=\s :rest)", sLine);
EXPECT_EQ(
R"(@CR=\r;LF=\n;NUL=\0;backslash=\\;semi-colon=\:;space=\s :rest)",
sLine);
tags = { {"a","; \\\r\n"} };
tags = {{"a", "; \\\r\n"}};
CUtils::SetMessageTags(sLine, tags);
EXPECT_EQ(R"(@a=\:\s\\\r\n :rest)", sLine);
}