-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathproxy_fmt_format_no_wchar_tests.cpp
More file actions
35 lines (25 loc) · 1.12 KB
/
proxy_fmt_format_no_wchar_tests.cpp
File metadata and controls
35 lines (25 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2022-2026 Microsoft Corporation.
// Copyright (c) 2026-Present Next Gen C++ Foundation.
// Licensed under the MIT License.
#include <gtest/gtest.h>
#include <fmt/format.h> // <fmt/xchar.h> is intentionally not included in this TU
#include <proxy/proxy.h>
#include <proxy/proxy_fmt.h>
namespace proxy_fmt_format_no_wchar_tests_details {
struct NonFormattable : pro::facade_builder::build {};
static_assert(
!std::is_default_constructible_v<
fmt::formatter<pro::proxy_indirect_accessor<NonFormattable>, char>>);
struct Formattable : pro::facade_builder //
::add_skill<pro::skills::fmt_format> //
::build {};
static_assert(std::is_default_constructible_v<
fmt::formatter<pro::proxy_indirect_accessor<Formattable>, char>>);
} // namespace proxy_fmt_format_no_wchar_tests_details
namespace details = proxy_fmt_format_no_wchar_tests_details;
TEST(ProxyFmtFormatNoWcharTests, TestFormat) {
int v = 123;
pro::proxy<details::Formattable> p = &v;
ASSERT_EQ(fmt::format("{}", *p), "123");
ASSERT_EQ(fmt::format("{:*<6}", *p), "123***");
}