| 46 | }; |
| 47 | |
| 48 | static std::string read_file(const std::string & fname) { |
| 49 | std::ifstream file(fname); |
| 50 | if (!file) { |
| 51 | throw std::runtime_error(string_format("error: failed to open file '%s'\n", fname.c_str())); |
| 52 | } |
| 53 | std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); |
| 54 | file.close(); |
| 55 | return content; |
| 56 | } |
| 57 | |
| 58 | static void write_file(const std::string & fname, const std::string & content) { |
| 59 | std::ofstream file(fname); |
no test coverage detected