test/format-test.cc: fixed shadowing warnings in gcc and clang

This commit is contained in:
Martin Wührer 2020-08-14 22:38:01 +02:00
parent 337f66aaf1
commit 7d13017add

View File

@ -316,14 +316,14 @@ TEST(MemoryBufferTest, Grow) {
} }
TEST(MemoryBufferTest, Allocator) { TEST(MemoryBufferTest, Allocator) {
typedef allocator_ref<mock_allocator<char>> TestAllocator; typedef allocator_ref<mock_allocator<char>> LocalTestAllocator;
basic_memory_buffer<char, 10, TestAllocator> buffer; basic_memory_buffer<char, 10, LocalTestAllocator> buffer;
EXPECT_EQ(nullptr, buffer.get_allocator().get()); EXPECT_EQ(nullptr, buffer.get_allocator().get());
StrictMock<mock_allocator<char>> alloc; StrictMock<mock_allocator<char>> alloc;
char mem; char mem;
{ {
basic_memory_buffer<char, 10, TestAllocator> buffer2( basic_memory_buffer<char, 10, LocalTestAllocator> buffer2(
(TestAllocator(&alloc))); (LocalTestAllocator(&alloc)));
EXPECT_EQ(&alloc, buffer2.get_allocator().get()); EXPECT_EQ(&alloc, buffer2.get_allocator().get());
size_t size = 2 * fmt::inline_buffer_size; size_t size = 2 * fmt::inline_buffer_size;
EXPECT_CALL(alloc, allocate(size)).WillOnce(Return(&mem)); EXPECT_CALL(alloc, allocate(size)).WillOnce(Return(&mem));
@ -333,9 +333,9 @@ TEST(MemoryBufferTest, Allocator) {
} }
TEST(MemoryBufferTest, ExceptionInDeallocate) { TEST(MemoryBufferTest, ExceptionInDeallocate) {
typedef allocator_ref<mock_allocator<char>> TestAllocator; typedef allocator_ref<mock_allocator<char>> LocalTestAllocator;
StrictMock<mock_allocator<char>> alloc; StrictMock<mock_allocator<char>> alloc;
basic_memory_buffer<char, 10, TestAllocator> buffer((TestAllocator(&alloc))); basic_memory_buffer<char, 10, LocalTestAllocator> buffer((LocalTestAllocator(&alloc)));
size_t size = 2 * fmt::inline_buffer_size; size_t size = 2 * fmt::inline_buffer_size;
std::vector<char> mem(size); std::vector<char> mem(size);
{ {
@ -408,8 +408,8 @@ TEST(UtilTest, SystemError) {
fmt::system_error error(0, ""); fmt::system_error error(0, "");
try { try {
throw fmt::system_error(EDOM, "test {}", "error"); throw fmt::system_error(EDOM, "test {}", "error");
} catch (const fmt::system_error& e) { } catch (const fmt::system_error& e_caught) {
error = e; error = e_caught;
} }
fmt::memory_buffer message; fmt::memory_buffer message;
fmt::format_system_error(message, EDOM, "test error"); fmt::format_system_error(message, EDOM, "test error");