Move posix tests from gtest-extra-test to a separate test

This commit is contained in:
vitaut
2015-06-24 09:16:03 -07:00
parent 9769f4b9ed
commit 0a7e5141c1
8 changed files with 455 additions and 404 deletions
+13
View File
@@ -89,6 +89,19 @@ std::string OutputRedirect::restore_and_read() {
return content;
}
std::string read(File &f, std::size_t count) {
std::string buffer(count, '\0');
std::streamsize n = 0;
std::size_t offset = 0;
do {
n = f.read(&buffer[offset], count - offset);
// We can't read more than size_t bytes since count has type size_t.
offset += static_cast<std::size_t>(n);
} while (offset < count && n != 0);
buffer.resize(offset);
return buffer;
}
#endif // FMT_USE_FILE_DESCRIPTORS
std::string format_system_error(int error_code, fmt::StringRef message) {