Changeset 258828 in webkit
- Timestamp:
- Mar 23, 2020 2:48:12 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r258826 r258828 1 2020-03-23 youenn fablet <youenn@apple.com> 2 3 StringView::startsWith and String::startsWith do not treat null strings the same 4 https://bugs.webkit.org/show_bug.cgi?id=209273 5 6 Reviewed by Darin Adler. 7 8 Align StringImpl with StringView and make startsWith return true if prefix is null. 9 10 * wtf/text/StringImpl.cpp: 11 (WTF::StringImpl::startsWith const): 12 1 13 2020-03-22 Antoine Quint <graouts@apple.com> 2 14 -
trunk/Source/WTF/wtf/text/StringImpl.cpp
r255125 r258828 1184 1184 bool StringImpl::startsWith(const StringImpl* string) const 1185 1185 { 1186 return string &&::WTF::startsWith(*this, *string);1186 return !string || ::WTF::startsWith(*this, *string); 1187 1187 } 1188 1188 -
trunk/Tools/ChangeLog
r258826 r258828 1 2020-03-23 youenn fablet <youenn@apple.com> 2 3 StringView::startsWith and String::startsWith do not treat null strings the same 4 https://bugs.webkit.org/show_bug.cgi?id=209273 5 6 Reviewed by Darin Adler. 7 8 * TestWebKitAPI/Tests/WTF/StringView.cpp: 9 (TestWebKitAPI::TEST): 10 * TestWebKitAPI/Tests/WTF/WTFString.cpp: 11 (TestWebKitAPI::TEST): 12 1 13 2020-03-22 Antoine Quint <graouts@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp
r251736 r258828 42 42 } 43 43 44 TEST(WTF, StringViewStartsWithEmptyVsNull) 45 { 46 StringView nullView; 47 StringView emptyView = StringView::empty(); 48 String stringWithCharacters("hello"); 49 StringView viewWithCharacters(stringWithCharacters); 50 51 EXPECT_TRUE(viewWithCharacters.startsWith(nullView)); 52 EXPECT_TRUE(viewWithCharacters.startsWith(emptyView)); 53 } 54 44 55 TEST(WTF, StringViewEmptyVsNull) 45 56 { -
trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp
r250389 r258828 72 72 } 73 73 74 TEST(WTF, StringStartsWithEmptyVsNull) 75 { 76 String nullString; 77 String emptyString = WTF::emptyString(); 78 String stringWithCharacters("hello"); 79 80 EXPECT_TRUE(stringWithCharacters.startsWith(nullString)); 81 EXPECT_TRUE(stringWithCharacters.startsWith(emptyString)); 82 } 83 74 84 static inline const char* testStringNumberFixedPrecision(double number) 75 85 {
Note: See TracChangeset
for help on using the changeset viewer.