diff options
author | Vlad Voicu <vladvoic@gmail.com> | 2011-04-29 18:13:05 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-04-30 08:35:40 (GMT) |
commit | 09f61b624e99f69a9221ba46c15efa61892f475f (patch) | |
tree | 636be7dd1399a4cf97fda4343d6f849d9eac2e34 /Swiften/Parser/PayloadParsers/UnitTest | |
parent | d4781a09b22013da45adf8e9e8b6484fd672a3ec (diff) | |
download | swift-contrib-09f61b624e99f69a9221ba46c15efa61892f475f.zip swift-contrib-09f61b624e99f69a9221ba46c15efa61892f475f.tar.bz2 |
Correct message feature using XEP-Correct
Uses Kev's not-yet-published protocol for correcting the last sent message.
Release-Notes: You can now correct your previously sent message in a chat by pressing 'up' in the input field.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp new file mode 100644 index 0000000..7c34eb1 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2011 Vlad Voicu + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/extensions/TestFactoryRegistry.h> + +#include "Swiften/Parser/PayloadParsers/ReplaceParser.h" +#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h" + +using namespace Swift; + +class ReplaceParserTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(ReplaceParserTest); + CPPUNIT_TEST(testParseTrivial); + CPPUNIT_TEST(testParseChild); + CPPUNIT_TEST_SUITE_END(); + + public: + void testParseTrivial() { + PayloadsParserTester parser; + CPPUNIT_ASSERT(parser.parse("<replace id='bad1' xmlns='http://swift.im/protocol/replace'/>")); + Replace::ref payload = boost::dynamic_pointer_cast <Replace>(parser.getPayload()); + CPPUNIT_ASSERT_EQUAL(std::string("bad1"), payload->getId()); + } + void testParseChild() { + PayloadsParserTester parser; + CPPUNIT_ASSERT(parser.parse("<replace id='bad1' xmlns='http://swift.im/protocol/replace' ><child xmlns='blah' id=\"hi\"/></replace>")); + Replace::ref payload = boost::dynamic_pointer_cast <Replace>(parser.getPayload()); + CPPUNIT_ASSERT_EQUAL(std::string("bad1"), payload->getId()); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(ReplaceParserTest); |