From b85efd66a76caccbe0c186b00cab34df1e4281fa Mon Sep 17 00:00:00 2001 From: Nemanja Trifunovic Date: Sun, 6 Jun 2021 11:09:04 -0400 Subject: [PATCH] Test string literals --- tests/test_cpp11.cpp | 3 +++ tests/test_cpp17.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/test_cpp11.cpp b/tests/test_cpp11.cpp index ac9177b..ee4ddd8 100644 --- a/tests/test_cpp11.cpp +++ b/tests/test_cpp11.cpp @@ -51,6 +51,9 @@ TEST(CPP11APITests, test_utf8to16) EXPECT_EQ (utf16result.size(), 4); EXPECT_EQ (utf16result[2], 0xd834); EXPECT_EQ (utf16result[3], 0xdd1e); + // Just to make sure it compiles with string literals + utf8to16(u8"simple"); + utf8to16("simple"); } TEST(CPP11APITests, test_utf32to8) diff --git a/tests/test_cpp17.cpp b/tests/test_cpp17.cpp index 3416126..4b87816 100644 --- a/tests/test_cpp17.cpp +++ b/tests/test_cpp17.cpp @@ -76,4 +76,13 @@ TEST(CPP17APITests, test_starts_with_bom) bool no_bbom = starts_with_bom(threechars); EXPECT_FALSE (no_bbom); } + +TEST(CPP17APITests, string_class_and_literals) +{ + const char* twochars = u8"ab"; + EXPECT_TRUE (is_valid(twochars)); + const string two_chars_string(twochars); + EXPECT_TRUE (is_valid(two_chars_string)); +} + #endif // C++ 11 or later