mirror of
https://github.com/fmtlib/fmt.git
synced 2025-10-31 22:21:41 +01:00
🎨 🐛 Rename all shadowed types and variables
This commit is contained in:
committed by
Victor Zverovich
parent
771292c328
commit
e904e891bd
@@ -219,12 +219,12 @@ TEST(AllocatorTest, allocator_ref) {
|
||||
check_forwarding(alloc, ref3);
|
||||
}
|
||||
|
||||
typedef allocator_ref<std::allocator<char>> TestAllocator;
|
||||
typedef allocator_ref<std::allocator<char>> std_allocator;
|
||||
|
||||
static void check_move_buffer(
|
||||
const char* str, basic_memory_buffer<char, 5, TestAllocator>& buffer) {
|
||||
const char* str, basic_memory_buffer<char, 5, std_allocator>& buffer) {
|
||||
std::allocator<char>* alloc = buffer.get_allocator().get();
|
||||
basic_memory_buffer<char, 5, TestAllocator> 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.
|
||||
EXPECT_EQ(str, std::string(&buffer[0], buffer.size()));
|
||||
EXPECT_EQ(str, std::string(&buffer2[0], buffer2.size()));
|
||||
@@ -236,7 +236,7 @@ static void check_move_buffer(
|
||||
|
||||
TEST(MemoryBufferTest, MoveCtorInlineBuffer) {
|
||||
std::allocator<char> alloc;
|
||||
basic_memory_buffer<char, 5, TestAllocator> buffer((TestAllocator(&alloc)));
|
||||
basic_memory_buffer<char, 5, std_allocator> buffer((std_allocator(&alloc)));
|
||||
const char test[] = "test";
|
||||
buffer.append(string_view(test, 4));
|
||||
check_move_buffer("test", buffer);
|
||||
@@ -248,14 +248,14 @@ TEST(MemoryBufferTest, MoveCtorInlineBuffer) {
|
||||
|
||||
TEST(MemoryBufferTest, MoveCtorDynamicBuffer) {
|
||||
std::allocator<char> alloc;
|
||||
basic_memory_buffer<char, 4, TestAllocator> buffer((TestAllocator(&alloc)));
|
||||
basic_memory_buffer<char, 4, std_allocator> buffer((std_allocator(&alloc)));
|
||||
const char test[] = "test";
|
||||
buffer.append(test, test + 4);
|
||||
const char* inline_buffer_ptr = &buffer[0];
|
||||
// Adding one more character causes the content to move from the inline to
|
||||
// a dynamically allocated buffer.
|
||||
buffer.push_back('a');
|
||||
basic_memory_buffer<char, 4, TestAllocator> buffer2(std::move(buffer));
|
||||
basic_memory_buffer<char, 4, std_allocator> buffer2(std::move(buffer));
|
||||
// Move should rip the guts of the first buffer.
|
||||
EXPECT_EQ(inline_buffer_ptr, &buffer[0]);
|
||||
EXPECT_EQ("testa", std::string(&buffer2[0], buffer2.size()));
|
||||
@@ -446,9 +446,9 @@ TEST(UtilTest, FormatSystemError) {
|
||||
}
|
||||
|
||||
TEST(UtilTest, SystemError) {
|
||||
fmt::system_error e(EDOM, "test");
|
||||
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), e.what());
|
||||
EXPECT_EQ(EDOM, e.error_code());
|
||||
fmt::system_error test_error(EDOM, "test");
|
||||
EXPECT_EQ(fmt::format("test: {}", get_system_error(EDOM)), test_error.what());
|
||||
EXPECT_EQ(EDOM, test_error.error_code());
|
||||
|
||||
fmt::system_error error(0, "");
|
||||
try {
|
||||
@@ -2097,7 +2097,7 @@ struct test_format_specs_handler {
|
||||
enum Result { NONE, PLUS, MINUS, SPACE, HASH, ZERO, ERROR };
|
||||
Result res = NONE;
|
||||
|
||||
fmt::align_t align = fmt::align::none;
|
||||
fmt::align_t alignment = fmt::align::none;
|
||||
char fill = 0;
|
||||
int width = 0;
|
||||
fmt::detail::arg_ref<char> width_ref;
|
||||
@@ -2111,7 +2111,7 @@ struct test_format_specs_handler {
|
||||
FMT_CONSTEXPR test_format_specs_handler(
|
||||
const test_format_specs_handler& other)
|
||||
: res(other.res),
|
||||
align(other.align),
|
||||
alignment(other.alignment),
|
||||
fill(other.fill),
|
||||
width(other.width),
|
||||
width_ref(other.width_ref),
|
||||
@@ -2119,7 +2119,7 @@ struct test_format_specs_handler {
|
||||
precision_ref(other.precision_ref),
|
||||
type(other.type) {}
|
||||
|
||||
FMT_CONSTEXPR void on_align(fmt::align_t a) { align = a; }
|
||||
FMT_CONSTEXPR void on_align(fmt::align_t a) { alignment = a; }
|
||||
FMT_CONSTEXPR void on_fill(fmt::string_view f) { fill = f[0]; }
|
||||
FMT_CONSTEXPR void on_plus() { res = PLUS; }
|
||||
FMT_CONSTEXPR void on_minus() { res = MINUS; }
|
||||
@@ -2151,7 +2151,7 @@ FMT_CONSTEXPR test_format_specs_handler parse_test_specs(const char (&s)[N]) {
|
||||
|
||||
TEST(FormatTest, ConstexprParseFormatSpecs) {
|
||||
typedef test_format_specs_handler handler;
|
||||
static_assert(parse_test_specs("<").align == fmt::align::left, "");
|
||||
static_assert(parse_test_specs("<").alignment == fmt::align::left, "");
|
||||
static_assert(parse_test_specs("*^").fill == '*', "");
|
||||
static_assert(parse_test_specs("+").res == handler::PLUS, "");
|
||||
static_assert(parse_test_specs("-").res == handler::MINUS, "");
|
||||
@@ -2262,7 +2262,7 @@ FMT_CONSTEXPR test_format_specs_handler check_specs(const char (&s)[N]) {
|
||||
|
||||
TEST(FormatTest, ConstexprSpecsChecker) {
|
||||
typedef test_format_specs_handler handler;
|
||||
static_assert(check_specs("<").align == fmt::align::left, "");
|
||||
static_assert(check_specs("<").alignment == fmt::align::left, "");
|
||||
static_assert(check_specs("*^").fill == '*', "");
|
||||
static_assert(check_specs("+").res == handler::PLUS, "");
|
||||
static_assert(check_specs("-").res == handler::MINUS, "");
|
||||
|
||||
Reference in New Issue
Block a user