mirror of
https://github.com/fmtlib/fmt.git
synced 2025-09-28 23:50:54 +02:00
Minor cleanup
This commit is contained in:
@@ -315,18 +315,17 @@ TEST(memory_buffer_test, move_ctor_inline_buffer) {
|
|||||||
std::allocator<char>* alloc = buffer.get_allocator().get();
|
std::allocator<char>* alloc = buffer.get_allocator().get();
|
||||||
basic_memory_buffer<char, 5, std_allocator> buffer2(std::move(buffer));
|
basic_memory_buffer<char, 5, std_allocator> buffer2(std::move(buffer));
|
||||||
// Move shouldn't destroy the inline content of the first buffer.
|
// Move shouldn't destroy the inline content of the first buffer.
|
||||||
EXPECT_EQ(str, std::string(&buffer[0], buffer.size()));
|
EXPECT_EQ(std::string(buffer.data(), buffer.size()), str);
|
||||||
EXPECT_EQ(str, std::string(&buffer2[0], buffer2.size()));
|
EXPECT_EQ(std::string(&buffer2[0], buffer2.size()), str);
|
||||||
EXPECT_EQ(5u, buffer2.capacity());
|
EXPECT_EQ(buffer2.capacity(), 5u);
|
||||||
// Move should transfer allocator.
|
// Move should transfer allocator.
|
||||||
EXPECT_EQ(nullptr, buffer.get_allocator().get());
|
EXPECT_EQ(buffer.get_allocator().get(), nullptr);
|
||||||
EXPECT_EQ(alloc, buffer2.get_allocator().get());
|
EXPECT_EQ(buffer2.get_allocator().get(), alloc);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto alloc = std::allocator<char>();
|
auto alloc = std::allocator<char>();
|
||||||
basic_memory_buffer<char, 5, std_allocator> buffer((std_allocator(&alloc)));
|
basic_memory_buffer<char, 5, std_allocator> buffer((std_allocator(&alloc)));
|
||||||
const char test[] = "test";
|
buffer.append(string_view("test"));
|
||||||
buffer.append(string_view(test, 4));
|
|
||||||
check_move_buffer("test", buffer);
|
check_move_buffer("test", buffer);
|
||||||
// Adding one more character fills the inline buffer, but doesn't cause
|
// Adding one more character fills the inline buffer, but doesn't cause
|
||||||
// dynamic allocation.
|
// dynamic allocation.
|
||||||
|
Reference in New Issue
Block a user