summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/common/UtilsTest.cpp14
-rw-r--r--test/core/parser/ParserStackTest.cpp7
-rw-r--r--test/plugins/xml/XmlParserTest.cpp2
3 files changed, 18 insertions, 5 deletions
diff --git a/test/core/common/UtilsTest.cpp b/test/core/common/UtilsTest.cpp
index 66458b2..53beb79 100644
--- a/test/core/common/UtilsTest.cpp
+++ b/test/core/common/UtilsTest.cpp
@@ -40,5 +40,19 @@ TEST(Utils, trim)
ASSERT_EQ("hello world", Utils::trim("hello world"));
}
+TEST(Utils, split)
+{
+ ASSERT_EQ(std::vector<std::string>({"ab"}), Utils::split("ab", '.'));
+ ASSERT_EQ(std::vector<std::string>({"a", ""}), Utils::split("a.", '.'));
+ ASSERT_EQ(std::vector<std::string>({"", ""}), Utils::split(".", '.'));
+ ASSERT_EQ(std::vector<std::string>({"a", "b"}), Utils::split("a.b", '.'));
+ ASSERT_EQ(std::vector<std::string>({"a", "b"}), Utils::split("a.b", '.'));
+ ASSERT_EQ(std::vector<std::string>({"a", "b", "c"}),
+ Utils::split("a.b.c", '.'));
+ ASSERT_EQ(std::vector<std::string>({"", "a", "b", "c"}),
+ Utils::split(".a.b.c", '.'));
+ ASSERT_EQ(std::vector<std::string>({"", "a", "be", "c", ""}),
+ Utils::split(".a.be.c.", '.'));
+}
}
diff --git a/test/core/parser/ParserStackTest.cpp b/test/core/parser/ParserStackTest.cpp
index 08c0548..ed57260 100644
--- a/test/core/parser/ParserStackTest.cpp
+++ b/test/core/parser/ParserStackTest.cpp
@@ -39,7 +39,7 @@ class TestHandler : public Handler {
public:
using Handler::Handler;
- void start(const Variant::mapType &args) override { startCount++; }
+ void start(Variant::mapType &args) override { startCount++; }
void end() override { endCount++; }
@@ -48,10 +48,9 @@ public:
void child(std::shared_ptr<Handler> handler) override { childCount++; }
};
-static Handler *createTestHandler(const ParserContext &ctx, std::string name,
- State state, State parentState, bool isChild)
+static Handler *createTestHandler(const HandlerData &data)
{
- return new TestHandler(ctx, name, state, parentState, isChild);
+ return new TestHandler(data);
}
static const std::multimap<std::string, HandlerDescriptor> TEST_HANDLERS{
diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp
index c47fd6a..fd13cb9 100644
--- a/test/plugins/xml/XmlParserTest.cpp
+++ b/test/plugins/xml/XmlParserTest.cpp
@@ -51,7 +51,7 @@ const char *TEST_DATA =
"<?xml version=\"1.0\" standalone=\"yes\"?>\n"
"<document a:bc=\"b\">\n"
" <head>\n"
- " <typesystem>\n"
+ " <typesystem name=\"color\">\n"
" <types>\n"
" <struct name=\"color\">\n"
" </struct>\n"