1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:38:12 +00:00

AK: Add String{,View}::is_whitespace()

+Tests!
This commit is contained in:
AnotherTest 2021-01-03 02:56:02 +03:30 committed by Andreas Kling
parent b795f582cf
commit f3ecea1fb3
5 changed files with 28 additions and 11 deletions

View file

@ -287,4 +287,15 @@ TEST_CASE(contains)
EXPECT(!AK::StringUtils::contains(test_string, "L", CaseSensitivity::CaseInsensitive));
}
TEST_CASE(is_whitespace)
{
EXPECT(AK::StringUtils::is_whitespace(""));
EXPECT(AK::StringUtils::is_whitespace(" "));
EXPECT(AK::StringUtils::is_whitespace(" \t"));
EXPECT(AK::StringUtils::is_whitespace(" \t\n"));
EXPECT(AK::StringUtils::is_whitespace(" \t\n\r\v"));
EXPECT(!AK::StringUtils::is_whitespace(" a "));
EXPECT(!AK::StringUtils::is_whitespace("a\t"));
}
TEST_MAIN(StringUtils)