Skip to content

Commit b15aa90

Browse files
committed
Added a few more trim tests.
1 parent 0ccbdca commit b15aa90

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/string_test.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,25 @@ TEST_CASE("StringView", "")
476476
TEST_CASE("Trim", "")
477477
{
478478
REQUIRE(bx::strLTrim("a", "a").isEmpty() );
479+
REQUIRE(0 == bx::strCmp(bx::strLTrim("aba", "a"), "ba") );
480+
479481
REQUIRE(bx::strRTrim("a", "a").isEmpty() );
480-
REQUIRE(bx::strTrim("a", "a").isEmpty() );
482+
REQUIRE(0 == bx::strCmp(bx::strRTrim("aba", "a"), "ab") );
483+
484+
REQUIRE(bx::strTrim("a", "a").isEmpty() );
485+
REQUIRE(0 == bx::strCmp(bx::strTrim("aba", "a"), "b") );
481486

482487
REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "ab"), "vgd") );
488+
483489
REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vagbd"), "") );
490+
REQUIRE(0 == bx::strCmp(bx::strTrimPrefix("abvgd", "vagbd"), "abvgd") );
491+
484492
REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vgd"), "abvgd") );
485493
REQUIRE(0 == bx::strCmp(bx::strLTrim("/555333/podmac/", "/"), "555333/podmac/") );
486494

487495
REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "vagbd"), "") );
496+
REQUIRE(0 == bx::strCmp(bx::strTrimSuffix("abvgd", "vagbd"), "abvgd") );
497+
488498
REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "abv"), "abvgd") );
489499
REQUIRE(0 == bx::strCmp(bx::strRTrim("/555333/podmac/", "/"), "/555333/podmac") );
490500

0 commit comments

Comments
 (0)