mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-14 01:32:07 +08:00
Added back tests for utf8 to utf16
This commit is contained in:
parent
03e20348e2
commit
50f3c88694
@ -157,3 +157,21 @@ TEST_CASE("default logger API", "[default logger]") {
|
||||
spdlog::drop_all();
|
||||
spdlog::set_pattern("%v");
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
TEST_CASE("utf8 to utf16 conversion using windows api", "[windows utf]") {
|
||||
spdlog::wmemory_buf_t buffer;
|
||||
|
||||
spdlog::details::os::utf8_to_wstrbuf("", buffer);
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L""));
|
||||
|
||||
spdlog::details::os::utf8_to_wstrbuf("abc", buffer);
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L"abc"));
|
||||
|
||||
spdlog::details::os::utf8_to_wstrbuf("\xc3\x28", buffer); // Invalid UTF-8 sequence.
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L"\xfffd("));
|
||||
|
||||
spdlog::details::os::utf8_to_wstrbuf("\xe3\x81\xad\xe3\x81\x93", buffer); // "Neko" in hiragana.
|
||||
REQUIRE(std::wstring(buffer.data(), buffer.size()) == std::wstring(L"\x306d\x3053"));
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user