diff options
author | Shannon Booth <shannon.ml.booth@gmail.com> | 2019-12-30 01:44:30 +1300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-29 22:04:22 +0100 |
commit | 24bc674d94c56d9fc6ac06f442bcf23d8f2db14f (patch) | |
tree | 5e062c0b40354341d2521f9e98922f23c5ff77c4 /AK/Tests/TestStringView.cpp | |
parent | 27df4eb43da57165b002215d6b23c3b6e300bf4a (diff) | |
download | serenity-24bc674d94c56d9fc6ac06f442bcf23d8f2db14f.zip |
AK: Add StringView::ends_with function
Diffstat (limited to 'AK/Tests/TestStringView.cpp')
-rw-r--r-- | AK/Tests/TestStringView.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/AK/Tests/TestStringView.cpp b/AK/Tests/TestStringView.cpp index efe2596151..e1af2efa46 100644 --- a/AK/Tests/TestStringView.cpp +++ b/AK/Tests/TestStringView.cpp @@ -42,6 +42,16 @@ TEST_CASE(starts_with) EXPECT(!test_string_view.starts_with("DEF")); } +TEST_CASE(ends_with) +{ + String test_string = "ABCDEF"; + StringView test_string_view = test_string.view(); + EXPECT(test_string_view.ends_with("DEF")); + EXPECT(test_string_view.ends_with("ABCDEF")); + EXPECT(!test_string_view.ends_with("ABCDE")); + EXPECT(!test_string_view.ends_with("ABCDEFG")); +} + TEST_CASE(lines) { String test_string = "a\nb\r\nc\rd"; |