summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-14 18:57:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-14 21:36:32 (GMT)
commitcb05f5a908e20006c954ce38755c2e422ecc2388 (patch)
treea793551a5fe279a57d4330119560e8542f745484 /Swiften/Parser/UnitTest
parentcad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff)
downloadswift-cb05f5a908e20006c954ce38755c2e422ecc2388.zip
swift-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2
Removed Swift::String.
Diffstat (limited to 'Swiften/Parser/UnitTest')
-rw-r--r--Swiften/Parser/UnitTest/ParserTester.h8
-rw-r--r--Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp8
-rw-r--r--Swiften/Parser/UnitTest/SerializingParserTest.cpp6
-rw-r--r--Swiften/Parser/UnitTest/StanzaParserTest.cpp18
-rw-r--r--Swiften/Parser/UnitTest/XMLParserTest.cpp98
-rw-r--r--Swiften/Parser/UnitTest/XMPPParserTest.cpp8
6 files changed, 73 insertions, 73 deletions
diff --git a/Swiften/Parser/UnitTest/ParserTester.h b/Swiften/Parser/UnitTest/ParserTester.h
index bdb9291..970c1be 100644
--- a/Swiften/Parser/UnitTest/ParserTester.h
+++ b/Swiften/Parser/UnitTest/ParserTester.h
@@ -25,19 +25,19 @@ namespace Swift {
delete xmlParser_;
}
- bool parse(const String& data) {
+ bool parse(const std::string& data) {
return xmlParser_->parse(data);
}
- virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
parser_->handleStartElement(element, ns, attributes);
}
- virtual void handleEndElement(const String& element, const String& ns) {
+ virtual void handleEndElement(const std::string& element, const std::string& ns) {
parser_->handleEndElement(element, ns);
}
- virtual void handleCharacterData(const String& data) {
+ virtual void handleCharacterData(const std::string& data) {
parser_->handleCharacterData(data);
}
diff --git a/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp b/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp
index 668846f..8e49764 100644
--- a/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp
+++ b/Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp
@@ -91,12 +91,12 @@ class PayloadParserFactoryCollectionTest : public CppUnit::TestFixture
private:
struct DummyFactory : public PayloadParserFactory {
- DummyFactory(const String& element = "") : element(element) {}
- virtual bool canParse(const String& e, const String&, const AttributeMap&) const {
- return element.isEmpty() ? true : element == e;
+ DummyFactory(const std::string& element = "") : element(element) {}
+ virtual bool canParse(const std::string& e, const std::string&, const AttributeMap&) const {
+ return element.empty() ? true : element == e;
}
virtual PayloadParser* createPayloadParser() { return NULL; }
- String element;
+ std::string element;
};
};
diff --git a/Swiften/Parser/UnitTest/SerializingParserTest.cpp b/Swiften/Parser/UnitTest/SerializingParserTest.cpp
index e7018a2..c0af493 100644
--- a/Swiften/Parser/UnitTest/SerializingParserTest.cpp
+++ b/Swiften/Parser/UnitTest/SerializingParserTest.cpp
@@ -35,7 +35,7 @@ class SerializingParserTest : public CppUnit::TestFixture
"</html>"
"</message>"));
- CPPUNIT_ASSERT_EQUAL(String(
+ CPPUNIT_ASSERT_EQUAL(std::string(
"<message to=\"me@foo.com\" type=\"chat\">"
"<body>Hello&lt;&amp;World</body>"
"<html xmlns=\"http://www.w3.org/1999/xhtml\">foo<b xmlns=\"http://www.w3.org/1999/xhtml\">bar</b>baz</html>"
@@ -45,7 +45,7 @@ class SerializingParserTest : public CppUnit::TestFixture
void testParse_Empty() {
SerializingParser testling;
- CPPUNIT_ASSERT_EQUAL(String(""), testling.getResult());
+ CPPUNIT_ASSERT_EQUAL(std::string(""), testling.getResult());
}
void testParse_ToplevelCharacterData() {
@@ -57,7 +57,7 @@ class SerializingParserTest : public CppUnit::TestFixture
testling.handleEndElement("message", "");
testling.handleCharacterData("bar");
- CPPUNIT_ASSERT_EQUAL(String("<message/>"), testling.getResult());
+ CPPUNIT_ASSERT_EQUAL(std::string("<message/>"), testling.getResult());
}
};
diff --git a/Swiften/Parser/UnitTest/StanzaParserTest.cpp b/Swiften/Parser/UnitTest/StanzaParserTest.cpp
index 48d24da..d57f798 100644
--- a/Swiften/Parser/UnitTest/StanzaParserTest.cpp
+++ b/Swiften/Parser/UnitTest/StanzaParserTest.cpp
@@ -115,7 +115,7 @@ class StanzaParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(JID("foo@example.com/blo"), testling.getStanza()->getTo());
CPPUNIT_ASSERT_EQUAL(JID("bar@example.com/baz"), testling.getStanza()->getFrom());
- CPPUNIT_ASSERT_EQUAL(String("id-123"), testling.getStanza()->getID());
+ CPPUNIT_ASSERT_EQUAL(std::string("id-123"), testling.getStanza()->getID());
}
private:
@@ -132,14 +132,14 @@ class StanzaParserTest : public CppUnit::TestFixture {
public:
MyPayload1Parser() {}
- virtual void handleStartElement(const String& element, const String&, const AttributeMap&) {
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap&) {
if (element != "mypayload1") {
getPayloadInternal()->hasChild = true;
}
}
- virtual void handleEndElement(const String&, const String&) {}
- virtual void handleCharacterData(const String&) {}
+ virtual void handleEndElement(const std::string&, const std::string&) {}
+ virtual void handleCharacterData(const std::string&) {}
};
class MyPayload1ParserFactory : public PayloadParserFactory
@@ -149,7 +149,7 @@ class StanzaParserTest : public CppUnit::TestFixture {
PayloadParser* createPayloadParser() { return new MyPayload1Parser(); }
- bool canParse(const String& element, const String&, const AttributeMap&) const {
+ bool canParse(const std::string& element, const std::string&, const AttributeMap&) const {
return element == "mypayload1";
}
};
@@ -165,9 +165,9 @@ class StanzaParserTest : public CppUnit::TestFixture {
public:
MyPayload2Parser() {}
- virtual void handleStartElement(const String&, const String&, const AttributeMap&) {}
- virtual void handleEndElement(const String&, const String&) {}
- virtual void handleCharacterData(const String&) {}
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {}
+ virtual void handleEndElement(const std::string&, const std::string&) {}
+ virtual void handleCharacterData(const std::string&) {}
};
@@ -177,7 +177,7 @@ class StanzaParserTest : public CppUnit::TestFixture {
MyPayload2ParserFactory() {}
PayloadParser* createPayloadParser() { return new MyPayload2Parser(); }
- bool canParse(const String& element, const String&, const AttributeMap&) const {
+ bool canParse(const std::string& element, const std::string&, const AttributeMap&) const {
return element == "mypayload2";
}
};
diff --git a/Swiften/Parser/UnitTest/XMLParserTest.cpp b/Swiften/Parser/UnitTest/XMLParserTest.cpp
index 2aae4cd..426b7a0 100644
--- a/Swiften/Parser/UnitTest/XMLParserTest.cpp
+++ b/Swiften/Parser/UnitTest/XMLParserTest.cpp
@@ -8,7 +8,7 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <vector>
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Parser/XMLParserClient.h"
#ifdef HAVE_EXPAT
#include "Swiften/Parser/ExpatParser.h"
@@ -45,23 +45,23 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[0].data);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), client_.events[0].attributes.size());
- CPPUNIT_ASSERT_EQUAL(String("get"), client_.events[0].attributes["type"]);
- CPPUNIT_ASSERT_EQUAL(String(), client_.events[0].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("get"), client_.events[0].attributes["type"]);
+ CPPUNIT_ASSERT_EQUAL(std::string(), client_.events[0].ns);
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[1].data);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), client_.events[1].attributes.size());
- CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[1].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[1].ns);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type);
- CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[2].data);
- CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[2].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[2].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[2].ns);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[3].type);
- CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[3].data);
- CPPUNIT_ASSERT_EQUAL(String(), client_.events[3].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[3].data);
+ CPPUNIT_ASSERT_EQUAL(std::string(), client_.events[3].ns);
}
void testParse_ElementInNamespacedElement() {
@@ -75,24 +75,24 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[0].data);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), client_.events[0].attributes.size());
- CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[0].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[0].ns);
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("name"), client_.events[1].data);
- CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[1].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("name"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[1].ns);
CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[2].type);
- CPPUNIT_ASSERT_EQUAL(String("Swift"), client_.events[2].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("Swift"), client_.events[2].data);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[3].type);
- CPPUNIT_ASSERT_EQUAL(String("name"), client_.events[3].data);
- CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[3].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("name"), client_.events[3].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[3].ns);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[4].type);
- CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[4].data);
- CPPUNIT_ASSERT_EQUAL(String("jabber:iq:version"), client_.events[4].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[4].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("jabber:iq:version"), client_.events[4].ns);
}
void testParse_CharacterData() {
@@ -103,25 +103,25 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(7), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("html"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("html"), client_.events[0].data);
CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[1].data);
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[2].type);
- CPPUNIT_ASSERT_EQUAL(String("i"), client_.events[2].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("i"), client_.events[2].data);
CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[3].type);
- CPPUNIT_ASSERT_EQUAL(String("bli"), client_.events[3].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("bli"), client_.events[3].data);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[4].type);
- CPPUNIT_ASSERT_EQUAL(String("i"), client_.events[4].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("i"), client_.events[4].data);
CPPUNIT_ASSERT_EQUAL(Client::CharacterData, client_.events[5].type);
- CPPUNIT_ASSERT_EQUAL(String("blo"), client_.events[5].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("blo"), client_.events[5].data);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[6].type);
- CPPUNIT_ASSERT_EQUAL(String("html"), client_.events[6].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("html"), client_.events[6].data);
}
void testParse_NamespacePrefix() {
@@ -132,20 +132,20 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("x"), client_.events[0].data);
- CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[0].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("x"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[0].ns);
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("y"), client_.events[1].data);
- CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[1].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("y"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[1].ns);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type);
- CPPUNIT_ASSERT_EQUAL(String("y"), client_.events[2].data);
- CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[2].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("y"), client_.events[2].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[2].ns);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[3].type);
- CPPUNIT_ASSERT_EQUAL(String("x"), client_.events[3].data);
- CPPUNIT_ASSERT_EQUAL(String("bla"), client_.events[3].ns);
+ CPPUNIT_ASSERT_EQUAL(std::string("x"), client_.events[3].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("bla"), client_.events[3].ns);
}
void testParse_UnhandledXML() {
@@ -156,10 +156,10 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[0].data);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[1].data);
}
void testParse_InvalidXML() {
@@ -184,10 +184,10 @@ class XMLParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[0].data);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("iq"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("iq"), client_.events[1].data);
}
void testParse_WhitespaceInAttribute() {
@@ -199,11 +199,11 @@ class XMLParserTest : public CppUnit::TestFixture {
"<presence/>"));
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), client_.events.size());
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("query"), client_.events[0].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("query"), client_.events[0].data);
CPPUNIT_ASSERT_EQUAL(Client::StartElement, client_.events[1].type);
- CPPUNIT_ASSERT_EQUAL(String("presence"), client_.events[1].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("presence"), client_.events[1].data);
CPPUNIT_ASSERT_EQUAL(Client::EndElement, client_.events[2].type);
- CPPUNIT_ASSERT_EQUAL(String("presence"), client_.events[2].data);
+ CPPUNIT_ASSERT_EQUAL(std::string("presence"), client_.events[2].data);
}
private:
@@ -213,30 +213,30 @@ class XMLParserTest : public CppUnit::TestFixture {
struct Event {
Event(
Type type,
- const String& data,
- const String& ns,
+ const std::string& data,
+ const std::string& ns,
const AttributeMap& attributes)
: type(type), data(data), ns(ns), attributes(attributes) {}
- Event(Type type, const String& data, const String& ns = String())
+ Event(Type type, const std::string& data, const std::string& ns = std::string())
: type(type), data(data), ns(ns) {}
Type type;
- String data;
- String ns;
+ std::string data;
+ std::string ns;
AttributeMap attributes;
};
Client() {}
- virtual void handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) {
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
events.push_back(Event(StartElement, element, ns, attributes));
}
- virtual void handleEndElement(const String& element, const String& ns) {
+ virtual void handleEndElement(const std::string& element, const std::string& ns) {
events.push_back(Event(EndElement, element, ns));
}
- virtual void handleCharacterData(const String& data) {
+ virtual void handleCharacterData(const std::string& data) {
events.push_back(Event(CharacterData, data));
}
diff --git a/Swiften/Parser/UnitTest/XMPPParserTest.cpp b/Swiften/Parser/UnitTest/XMPPParserTest.cpp
index 1eaa798..8ce96d8 100644
--- a/Swiften/Parser/UnitTest/XMPPParserTest.cpp
+++ b/Swiften/Parser/UnitTest/XMPPParserTest.cpp
@@ -9,7 +9,7 @@
#include <vector>
#include "Swiften/Elements/ProtocolHeader.h"
-#include "Swiften/Base/String.h"
+#include <string>
#include "Swiften/Parser/XMPPParser.h"
#include "Swiften/Parser/ElementParser.h"
#include "Swiften/Parser/XMPPParserClient.h"
@@ -49,7 +49,7 @@ class XMPPParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(5, static_cast<int>(client_.events.size()));
CPPUNIT_ASSERT_EQUAL(Client::StreamStart, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].header->getTo());
+ CPPUNIT_ASSERT_EQUAL(std::string("example.com"), client_.events[0].header->getTo());
CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[1].type);
CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[2].type);
CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[3].type);
@@ -64,8 +64,8 @@ class XMPPParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(client_.events.size()));
CPPUNIT_ASSERT_EQUAL(Client::StreamStart, client_.events[0].type);
- CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].header->getFrom());
- CPPUNIT_ASSERT_EQUAL(String("aeab"), client_.events[0].header->getID());
+ CPPUNIT_ASSERT_EQUAL(std::string("example.com"), client_.events[0].header->getFrom());
+ CPPUNIT_ASSERT_EQUAL(std::string("aeab"), client_.events[0].header->getID());
}