Added test_save_load for JSON

This commit is contained in:
Patrick Urbanke
2023-11-12 20:51:00 +01:00
parent fe6f580e4f
commit 992115c6a0
5 changed files with 77 additions and 2 deletions
+2 -1
View File
@@ -10,7 +10,8 @@ namespace json {
template <class T>
Result<T> load(const std::string& _fname) {
return rfl::io::load_string(_fname).and_then(read<T>);
const auto read_string = [](const auto& _str) { return read<T>(_str); };
return rfl::io::load_string(_fname).and_then(read_string);
}
} // namespace json
+1 -1
View File
@@ -14,7 +14,7 @@ namespace json {
template <class T>
Result<Nothing> save(const std::string& _fname, const T& _obj) {
return rfl::io::save_string(write(_obj));
return rfl::io::save_string(_fname, write(_obj));
}
} // namespace json