Put File, BufferedFile & ErrorCode in the fmt namespace.

This commit is contained in:
Victor Zverovich
2014-06-09 09:07:27 -07:00
parent b692ab58b2
commit eaa89e23d7
8 changed files with 80 additions and 60 deletions

View File

@@ -1466,6 +1466,9 @@ TEST(FormatterTest, OutputNotWrittenOnError) {
#if FMT_USE_FILE_DESCRIPTORS
using fmt::BufferedFile;
using fmt::File;
TEST(FormatterTest, FileSink) {
File read_end, write_end;
File::pipe(read_end, write_end);

View File

@@ -356,6 +356,10 @@ TEST(UtilTest, FormatSystemErrorMessage) {
#if FMT_USE_FILE_DESCRIPTORS
using fmt::BufferedFile;
using fmt::ErrorCode;
using fmt::File;
// Checks if the file is open by reading one character from it.
bool IsOpen(int fd) {
char buffer;

View File

@@ -29,7 +29,7 @@
#if FMT_USE_FILE_DESCRIPTORS
#include "posix.cc"
using fmt::File;
void OutputRedirect::Flush() {
#if EOF != -1

View File

@@ -99,8 +99,8 @@ std::string FormatSystemErrorMessage(int error_code, fmt::StringRef message);
class OutputRedirect {
private:
FILE *file_;
File original_; // Original file passed to redirector.
File read_end_; // Read end of the pipe where the output is redirected.
fmt::File original_; // Original file passed to redirector.
fmt::File read_end_; // Read end of the pipe where the output is redirected.
GTEST_DISALLOW_COPY_AND_ASSIGN_(OutputRedirect);

View File

@@ -37,6 +37,10 @@
#include "gtest-extra.h"
using fmt::BufferedFile;
using fmt::ErrorCode;
using fmt::File;
namespace {
int open_count;
int close_count;