Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: znc/znc
base: 4b446cdf5ae1
...
head fork: znc/znc
compare: 5237e89bc318
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
4 Makefile.in
@@ -47,9 +47,9 @@ LIB_SRCS := $(addprefix src/,$(LIB_SRCS))
BIN_SRCS := src/main.cpp
LIB_OBJS := $(patsubst %cpp,%o,$(LIB_SRCS))
BIN_OBJS := $(patsubst %cpp,%o,$(BIN_SRCS))
-TESTS := StringTest ConfigTest
+TESTS := StringTest ConfigTest UtilsTest
TESTS := $(addprefix test/,$(addsuffix .o,$(TESTS)))
-CLEAN := znc src/*.o test/*.o core core.* .version_extra .depend modules/.depend
+CLEAN := znc src/*.o test/*.o core core.* .version_extra .depend modules/.depend unittest
DISTCLEAN := Makefile config.log config.status znc-buildmod \
modules/Makefile man/Makefile znc.pc znc-uninstalled.pc test/Makefile
View
1  configure.ac
@@ -638,7 +638,6 @@ AC_CONFIG_FILES([man/Makefile])
AC_CONFIG_FILES([znc.pc])
AC_CONFIG_FILES([znc-uninstalled.pc])
AC_CONFIG_FILES([modules/Makefile])
-AC_CONFIG_FILES([test/Makefile])
AC_OUTPUT
echo
View
2  src/Utils.cpp
@@ -466,7 +466,7 @@ MCString CUtils::GetMessageTags(const CString& sLine) {
MCString mssTags;
for (VCString::const_iterator it = vsTags.begin(); it != vsTags.end(); ++it) {
- mssTags[it->Token(0, false, "=")] = it->Token(1, true, "=");
+ mssTags[it->Token(0, false, "=", true)] = it->Token(1, true, "=", true);
}
return mssTags;
}
View
50 test/Makefile.in
@@ -1,50 +0,0 @@
-SHELL := @SHELL@
-
-# Support out-of-tree builds
-srcdir := @srcdir@
-VPATH := @srcdir@
-
-CXX := @CXX@
-CXXFLAGS := -I$(srcdir)/../include -I../include @CPPFLAGS@ @CXXFLAGS@
-LDFLAGS := @LDFLAGS@
-LIBS := @LIBS@
-
-TARGETS := ConfigTest
-OBJS := $(addsuffix .o, $(TARGETS))
-ZNC_OBJS := Config.o ZNCDebug.o FileUtils.o Utils.o ZNCString.o MD5.o SHA256.o
-ZNC_OBJS := $(addprefix ../src/, $(ZNC_OBJS))
-
-ifneq "$(V)" ""
-VERBOSE=1
-endif
-ifeq "$(VERBOSE)" ""
-Q=@
-E=@echo
-C=-s
-else
-Q=
-E=@\#
-C=
-endif
-
-.PHONY: test
-
-all: $(TARGETS)
-
-ConfigTest: ConfigTest.o
- $(E) Linking $@...
- $(Q)$(CXX) $(LDFLAGS) -o $@ $< $(ZNC_OBJS) $(LIBS)
-
-EscapeTest: EscapeTest.o
- $(E) Linking $@...
- $(Q)$(CXX) $(LDFLAGS) -o $@ $< $(ZNC_OBJS) $(LIBS)
-
-%.o: %.cpp Makefile
- @mkdir -p .depend
- $(E) Building $@...
- $(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MMD -MF .depend/$@.dep
-
-test: $(TARGETS)
- for test in $(TARGETS) ; do \
- ./$$test || exit 1 ; \
- done
View
58 test/UtilsTest.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2004-2014 ZNC, see the NOTICE file for details.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <znc/FileUtils.h>
+#include <znc/Utils.h>
+
+TEST(IRC32, GetMessageTags) {
+ EXPECT_EQ(MCString(), CUtils::GetMessageTags(""));
+ EXPECT_EQ(MCString(), CUtils::GetMessageTags(":nick!ident@host PRIVMSG #chan :hello world"));
+
+ MCString exp;
+ 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 :rest"));
+ exp.clear();
+
+ exp["ab"] = "cdef";
+ exp["znc.in/gh-ij"] = "klmn,op";
+ EXPECT_EQ(exp, CUtils::GetMessageTags("@ab=cdef;znc.in/gh-ij=klmn,op :rest"));
+ exp.clear();
+
+ exp["a"] = "==b==";
+ EXPECT_EQ(exp, CUtils::GetMessageTags("@a===b== :rest"));
+ exp.clear();
+}
+
+TEST(IRC32, SetMessageTags) {
+ CString sLine;
+
+ sLine = ":rest";
+ CUtils::SetMessageTags(sLine, MCString());
+ EXPECT_EQ(":rest", sLine);
+
+ MCString tags;
+ tags["a"] = "b";
+ CUtils::SetMessageTags(sLine, tags);
+ EXPECT_EQ("@a=b :rest", sLine);
+
+ tags["c"] = "d";
+ CUtils::SetMessageTags(sLine, tags);
+ EXPECT_EQ("@a=b;c=d :rest", sLine);
+}
+

No commit comments for this range

Something went wrong with that request. Please try again.