fmt/test/std-test.cc
Vladislav Shchapov 232e21d51f Add utf-8 test for std::filesystem::path formatter.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2022-06-04 10:10:21 -07:00

28 lines
757 B
C++

// Formatting library for C++ - tests of formatters for standard library types
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#include "fmt/std.h"
#include "gtest/gtest.h"
TEST(std_test, path) {
#ifdef __cpp_lib_filesystem
EXPECT_EQ(fmt::format("{:8}", std::filesystem::path("foo")), "\"foo\" ");
EXPECT_EQ(fmt::format("{}", std::filesystem::path("foo\"bar.txt")),
"\"foo\\\"bar.txt\"");
# ifdef _WIN32
EXPECT_EQ(fmt::format("{}", std::filesystem::path(L"Файл.txt")),
"\"\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbb.txt\"");
# endif
#endif
}
TEST(std_test, thread_id) {
EXPECT_FALSE(fmt::format("{}", std::this_thread::get_id()).empty());
}