mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
works with JSON_NO_IO
This commit is contained in:
@@ -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>());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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>());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -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/"};
|
||||
|
||||
Reference in New Issue
Block a user