diff --git a/format-test.cc b/format-test.cc index f20d3fa9..452f0999 100644 --- a/format-test.cc +++ b/format-test.cc @@ -328,6 +328,14 @@ TEST(WriterTest, WriteDoubleAtBufferBoundary) { writer << 1.23456789; } +TEST(WriterTest, WriteDoubleWithFilledBuffer) { + fmt::Writer writer; + // Fill the buffer. + for (int i = 0; i < fmt::internal::INLINE_BUFFER_SIZE; ++i) + writer << ' '; + writer << 1.2; +} + TEST(WriterTest, WriteChar) { CHECK_WRITE('a'); } diff --git a/format.h b/format.h index 18c9567b..00a4a2f3 100644 --- a/format.h +++ b/format.h @@ -92,6 +92,8 @@ FMT_GCC_EXTENSION typedef long long LongLong; FMT_GCC_EXTENSION typedef unsigned long long ULongLong; namespace internal { + +enum { INLINE_BUFFER_SIZE = 500 }; #if _SECURE_SCL template @@ -648,8 +650,7 @@ class BasicFormatter; template class BasicWriter { private: - enum { INLINE_BUFFER_SIZE = 500 }; - mutable internal::Array buffer_; // Output buffer. + mutable internal::Array buffer_; // Output buffer. friend class BasicFormatter;