summaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-11-30 21:44:44 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-12 02:55:41 +0100
commit488290a83e01cb50029e2c14e02fc7c4bd996aab (patch)
tree9aa2bb8a7bc7361c799b003f7ab188fb1a83d0f3 /staging_vespalib/src/tests
parent602bb910df6998d0f7c56a67d2707c9c6c2e7d58 (diff)
Targeted include and cast to avoid template generation.
Diffstat (limited to 'staging_vespalib/src/tests')
-rw-r--r--staging_vespalib/src/tests/json/json.cpp5
-rw-r--r--staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp10
2 files changed, 8 insertions, 7 deletions
diff --git a/staging_vespalib/src/tests/json/json.cpp b/staging_vespalib/src/tests/json/json.cpp
index 16d27643983..aeedb695790 100644
--- a/staging_vespalib/src/tests/json/json.cpp
+++ b/staging_vespalib/src/tests/json/json.cpp
@@ -1,11 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
-#include <vespa/log/log.h>
-LOG_SETUP("json_test");
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/jsonstream.h>
+#include <vespa/vespalib/util/jsonexception.h>
#include <cmath>
using namespace vespalib;
diff --git a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp
index a44802735eb..f07749b0104 100644
--- a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp
+++ b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp
@@ -30,15 +30,17 @@ Test::Main()
TEST_DONE();
}
+
void
Test::testNormalUsage()
{
+ const char * UP = "up";
std::ostringstream ost;
XmlOutputStream xos(ost);
using namespace vespalib::xml;
xos << XmlTag("car")
<< XmlTag("door")
- << XmlAttribute("windowstate", "up")
+ << XmlAttribute("windowstate", UP)
<< XmlEndTag()
<< XmlTag("description")
<< "This is a car description used to test"
@@ -55,12 +57,13 @@ Test::testNormalUsage()
void
Test::testEscaping()
{
+ const char * P100 = "<100%\" &\n>";
std::ostringstream ost;
XmlOutputStream xos(ost);
using namespace vespalib::xml;
xos << XmlTag("!#trash%-", CONVERT_ILLEGAL_CHARACTERS)
<< XmlTag("foo")
- << XmlAttribute("bar", "<100%\" &\n>")
+ << XmlAttribute("bar", P100)
<< XmlEndTag()
<< XmlTag("escaped")
<< XmlEscapedContent()
@@ -89,13 +92,14 @@ Test::testEscaping()
}
namespace {
+ const char * BLUE = "blue";
struct LookAndFeel : public XmlSerializable {
LookAndFeel() {}
void printXml(XmlOutputStream& out) const {
using namespace vespalib::xml;
- out << XmlAttribute("color", "blue")
+ out << XmlAttribute("color", BLUE)
<< XmlTag("other")
<< XmlAttribute("count", 5)
<< XmlTag("something") << "foo" << XmlEndTag()