works with JSON_NO_IO

This commit is contained in:
pantor
2021-11-17 10:39:53 +01:00
parent dc3451173f
commit ab6d006443
4 changed files with 8 additions and 8 deletions

View File

@@ -165,9 +165,8 @@ public:
if (file.fail()) {
INJA_THROW(FileError("failed accessing file at '" + input_path + filename + "'"));
}
json j;
file >> j;
return j;
return json::parse(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
}
/*!

View File

@@ -458,7 +458,7 @@ class Renderer : public NodeVisitor {
if (value.is_string()) {
os << value.get<std::string>(); // otherwise the value is surrounded with ""
} else {
os << value;
os << value.dump();
}
sep = separator;
}

View File

@@ -2538,7 +2538,7 @@ class Renderer : public NodeVisitor {
if (value.is_string()) {
os << value.get<std::string>(); // otherwise the value is surrounded with ""
} else {
os << value;
os << value.dump();
}
sep = separator;
}
@@ -2867,9 +2867,8 @@ public:
if (file.fail()) {
INJA_THROW(FileError("failed accessing file at '" + input_path + filename + "'"));
}
json j;
file >> j;
return j;
return json::parse(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
}
/*!

View File

@@ -3,6 +3,8 @@
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest/doctest.h"
#define JSON_NO_IO 1
#include "inja/inja.hpp"
const std::string test_file_directory {"../test/data/"};