mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
AK: Remove superfluous check from Utf16View::equals_ignoring_case()
Returning true if both lengths are 0 is already handled by the default case.
This commit is contained in:
parent
b558b4dba6
commit
7d7f6fa494
|
|
@ -344,8 +344,6 @@ size_t Utf16View::calculate_length_in_code_points() const
|
|||
|
||||
bool Utf16View::equals_ignoring_case(Utf16View const& other) const
|
||||
{
|
||||
if (length_in_code_units() == 0)
|
||||
return other.length_in_code_units() == 0;
|
||||
if (length_in_code_units() != other.length_in_code_units())
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -307,6 +307,21 @@ TEST_CASE(decode_invalid_utf16)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(equals_ignoring_case)
|
||||
{
|
||||
auto string1 = MUST(AK::utf8_to_utf16("foobar"sv));
|
||||
auto string2 = MUST(AK::utf8_to_utf16("FooBar"sv));
|
||||
EXPECT(Utf16View { string1 }.equals_ignoring_case(Utf16View { string2 }));
|
||||
|
||||
string1 = MUST(AK::utf8_to_utf16(""sv));
|
||||
string2 = MUST(AK::utf8_to_utf16(""sv));
|
||||
EXPECT(Utf16View { string1 }.equals_ignoring_case(Utf16View { string2 }));
|
||||
|
||||
string1 = MUST(AK::utf8_to_utf16(""sv));
|
||||
string2 = MUST(AK::utf8_to_utf16("FooBar"sv));
|
||||
EXPECT(!Utf16View { string1 }.equals_ignoring_case(Utf16View { string2 }));
|
||||
}
|
||||
|
||||
TEST_CASE(substring_view)
|
||||
{
|
||||
auto string = MUST(AK::utf8_to_utf16("Привет 😀"sv));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user