summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/xml/unittests/testxml.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/project2/xml/unittests/testxml.cpp b/project2/xml/unittests/testxml.cpp
index 539c0a0..52dda4b 100644
--- a/project2/xml/unittests/testxml.cpp
+++ b/project2/xml/unittests/testxml.cpp
@@ -16,6 +16,14 @@ systembf(const char * fmt, const T & ... params)
return system(stringbf(fmt, params...).c_str());
}
+const boost::filesystem::path tmpdir = "/tmp/ut/project2.xml";
+
+BOOST_AUTO_TEST_CASE( before )
+{
+ boost::filesystem::remove_all(tmpdir);
+ boost::filesystem::create_directories(tmpdir);
+}
+
BOOST_AUTO_TEST_CASE( rawview )
{
TestOptionsSource::LoadTestOptions({ });
@@ -24,11 +32,12 @@ BOOST_AUTO_TEST_CASE( rawview )
h->executeViews(NULL);
auto p = boost::dynamic_pointer_cast<XmlPresenter>(h->getPresenter(NULL));
BOOST_REQUIRE(p);
- std::fstream strm("/tmp/out.xml", std::ios::out);
+ const auto out = tmpdir / "rawview.xml";
+ std::fstream strm(out.string(), std::ios::out);
BOOST_REQUIRE(strm.is_open());
p->writeTo(strm, "utf-8", NULL);
BOOST_REQUIRE_EQUAL(0, systembf("diff -w --unified %s %s",
- "/tmp/out.xml",
+ out,
RootDir / "expected" / "rawview.xml"));
}