Skip to content

Commit

Permalink
ICU-22843 Add a test case that's ambiguous to MSVC and fails to compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
roubert committed Sep 11, 2024
1 parent fda2223 commit 376f10d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions icu4c/source/test/intltest/ustrtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2420,6 +2420,7 @@ void UnicodeStringTest::TestU16StringView() {
const char16_t *p16 = u"p16";
std::u16string_view sv16 = u"sv16";
std::u16string str16 = u"str16";
UnicodeString ustr = u"ustr";

// These copy the string contents.
UnicodeString fromPtr(p16); // pointer is convertible to std::u16string_view
Expand All @@ -2444,6 +2445,10 @@ void UnicodeStringTest::TestU16StringView() {
assertTrue("aliasFromStr pointer alias", aliasFromStr.getBuffer() == str16.data());
assertEquals("aliasFromStr length", (int32_t)str16.length(), aliasFromStr.length());

UnicodeString aliasFromUStr = UnicodeString::readOnlyAlias(ustr);
assertTrue("aliasFromUStr pointer alias", aliasFromUStr.getBuffer() == ustr.getBuffer());
assertEquals("aliasFromUStr length", ustr.length(), aliasFromUStr.length());

// operator==
UnicodeString any(true, u"any", 3);
assertFalse("any == pointer-p16", any == p16);
Expand Down

0 comments on commit 376f10d

Please sign in to comment.