Test "move".

This commit is contained in:
Victor Zverovich 2014-04-29 07:58:20 -07:00
parent e00409c517
commit 48be5c22a2

View File

@ -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<CountingSink> 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;
{