#include "core/fxcrt/code_point_view.h"
#include <string>
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
CodePointView;
std::u32string Materialize(CodePointView view) { … }
}
TEST(CodePointViewTest, Empty) { … }
TEST(CodePointViewTest, Basic) { … }
TEST(CodePointViewTest, Supplementary) { … }
TEST(CodePointViewTest, UnpairedHighSurrogate) { … }
TEST(CodePointViewTest, UnpairedLowSurrogate) { … }
#if defined(WCHAR_T_IS_16_BIT)
TEST(CodePointViewTest, SurrogateErrorRecovery) {
EXPECT_EQ(U"(\xd800)", Materialize(CodePointView(L"(\xd800)"))) << "High";
EXPECT_EQ(U"(\xdc00)", Materialize(CodePointView(L"(\xdc00)"))) << "Low";
EXPECT_EQ(U"(\xd800🎨)", Materialize(CodePointView(L"(\xd800\xd83c\xdfa8)")))
<< "High-high";
EXPECT_EQ(U"(🎨\xdc00)", Materialize(CodePointView(L"(\xd83c\xdfa8\xdc00)")))
<< "Low-low";
}
#endif