Skip to content

Commit

Permalink
Test string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
nemtrif committed Jun 6, 2021
1 parent 4e11497 commit b85efd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_cpp11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_cpp17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b85efd6

Please sign in to comment.