From 48be5c22a2ee453d8310b3148b55f39200273a96 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 29 Apr 2014 07:58:20 -0700 Subject: [PATCH] Test "move". --- format-test.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/format-test.cc b/format-test.cc index 84461d5f..97f38010 100644 --- a/format-test.cc +++ b/format-test.cc @@ -1521,6 +1521,19 @@ TEST(FormatterTest, Sink) { EXPECT_EQ(1, num_writes); } +TEST(FormatterTest, Move) { + // Test if formatting is performed once if we "move" a formatter. + int num_writes = 0; + { + typedef fmt::Formatter TestFormatter; + TestFormatter *f = new TestFormatter("test", CountingSink(num_writes)); + TestFormatter f2(*f); + delete f; + EXPECT_EQ(0, num_writes); + } + EXPECT_EQ(1, num_writes); +} + TEST(FormatterTest, OutputNotWrittenOnError) { int num_writes = 0; {