summaryrefslogtreecommitdiff
path: root/test/plugins/xml/XmlParserTest.cpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-01 15:13:02 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-01-01 15:13:02 +0100
commit0b4711c86e97fa81265d0e0ef29027d5795ee8d9 (patch)
tree9cc05e2fb4119656c3715feae4b0cbe10f86e44a /test/plugins/xml/XmlParserTest.cpp
parentdf0f3f2d143395b21162058c0b3ac274c7fc4df3 (diff)
Adapted unit tests
Diffstat (limited to 'test/plugins/xml/XmlParserTest.cpp')
-rw-r--r--test/plugins/xml/XmlParserTest.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/plugins/xml/XmlParserTest.cpp b/test/plugins/xml/XmlParserTest.cpp
index 39b1a9d..c5a7b10 100644
--- a/test/plugins/xml/XmlParserTest.cpp
+++ b/test/plugins/xml/XmlParserTest.cpp
@@ -20,12 +20,16 @@
#include <gtest/gtest.h>
+#include <core/common/Logger.hpp>
+
#include <plugins/xml/XmlParser.hpp>
namespace ousia {
namespace parser {
namespace xml {
+TerminalLogger logger(std::cerr, true);
+
TEST(XmlParser, mismatchedTagException)
{
StandaloneParserContext ctx;
@@ -35,8 +39,8 @@ TEST(XmlParser, mismatchedTagException)
try {
p.parse("<document>\n</document2>", ctx);
}
- catch (ParserException ex) {
- ASSERT_EQ(2U, ex.pos.line);
+ catch (LoggableException ex) {
+ ASSERT_EQ(2U, ex.loc.line);
hadException = true;
}
ASSERT_TRUE(hadException);
@@ -47,8 +51,10 @@ const char *TEST_DATA =
"<document a:bc=\"b\">\n"
" <head>\n"
" <typesystem name=\"color\">\n"
- " <struct name=\"color\">\n"
- " </struct>\n"
+ " <types>\n"
+ " <struct name=\"color\">\n"
+ " </struct>\n"
+ " </type>\n"
" </typesystem>\n"
" </head>\n"
" <body xmlAttr=\"blub\">\n"
@@ -58,10 +64,14 @@ const char *TEST_DATA =
TEST(XmlParser, namespaces)
{
- StandaloneParserContext ctx;
+ StandaloneParserContext ctx(logger);
XmlParser p;
- p.parse(TEST_DATA, ctx);
+ try {
+ p.parse(TEST_DATA, ctx);
+ } catch(LoggableException ex) {
+ logger.log(ex);
+ }
}
}
}