summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2017-06-26 13:18:09 (GMT)
committerTobias Markmann <tm@ayena.de>2017-07-14 13:19:16 (GMT)
commitf21c9448c5187493fd08574962d88c2db1405512 (patch)
treed8facf4bed5c792833719a1685084b8b4a676d87 /Swiften/Parser/PayloadParsers/UnitTest
parent0b4aaa1def9625ca3b4ddf869c988a68483135f8 (diff)
downloadswift-f21c9448c5187493fd08574962d88c2db1405512.zip
swift-f21c9448c5187493fd08574962d88c2db1405512.tar.bz2
Add MIXRegisterNick Element, its Parser and Serializer
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Added tests for MIXRegisterNick Parser and Serializer based on examples in XEP 0369, which passes. Tested on Ubuntu 16.04 LTS. Change-Id: I80796db9d540c58296afa3454f29e1fb81d04615
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp
new file mode 100644
index 0000000..d0539fd
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Elements/MIXRegisterNick.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXRegisterNickParserTest, WithNick) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<register xmlns=\"urn:xmpp:mix:0\"> <nick>thirdwitch</nick> </register>"
+ ));
+
+ auto payload = parser.getPayload<MIXRegisterNick>();
+ ASSERT_TRUE(payload);
+ ASSERT_EQ("thirdwitch", payload->getNick());
+}