From da9457da61fd7b35272230bfd9aaadb4d95f4d19 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 16 Jun 2014 07:48:57 -0700 Subject: [PATCH] Add a test case for https://github.com/cppformat/cppformat/pull/47 --- test/format-test.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/format-test.cc b/test/format-test.cc index 14ff1b52..95ca2dc2 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -267,6 +267,16 @@ TEST(ArrayTest, Append) { EXPECT_EQ(15u, array.capacity()); } +TEST(ArrayTest, AppendAllocatesEnoughStorage) { + Array array; + const char *test = "abcdefgh"; + array.resize(10); + array.append(test, test + 9); + EXPECT_STREQ("test", &array[10]); + EXPECT_EQ(19u, array.size()); + EXPECT_EQ(19u, array.capacity()); +} + TEST(WriterTest, Ctor) { Writer w; EXPECT_EQ(0u, w.size());