Skip to content

Commit

Permalink
test_xmlParser might be be running in coda-oss
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Dec 9, 2021
1 parent 3526cd0 commit f21f79d
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ namespace fs = std::filesystem;

static fs::path findRoot(const fs::path& p)
{
if (p.empty())
{
return p;
}
const fs::path LICENSE("LICENSE");
const fs::path README_md("README.md");
const fs::path CMakeLists_txt("CMakeLists.txt");
Expand Down Expand Up @@ -262,8 +266,13 @@ static void testReadEncodedXmlFile(const std::string& testName, const std::strin
{
const auto coda_oss = findRoot();
const auto unittests = coda_oss / "modules" / "c++" / "xml.lite" / "unittests";

io::FileInputStream input((unittests / xmlFile).string());

const auto path = unittests / xmlFile;
if (!exists(path)) // running in "externals" of a different project
{
return;
}
io::FileInputStream input(path.string());

xml::lite::MinidomParser xmlParser(true /*storeEncoding*/);
xmlParser.preserveCharacterData(true);
Expand Down Expand Up @@ -299,7 +308,12 @@ static void testReadXmlFile(const std::string& testName, const std::string& xmlF
const auto coda_oss = findRoot();
const auto unittests = coda_oss / "modules" / "c++" / "xml.lite" / "unittests";

io::FileInputStream input((unittests / xmlFile).string());
const auto path = unittests / xmlFile;
if (!exists(path)) // running in "externals" of a different project
{
return;
}
io::FileInputStream input(path.string());

xml::lite::MinidomParser xmlParser(true /*storeEncoding*/);
xmlParser.preserveCharacterData(true);
Expand Down

0 comments on commit f21f79d

Please sign in to comment.