Skip to content

Commit

Permalink
Add tests for removeprefix and removesuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
niclasr committed Mar 4, 2022
1 parent 5a0840a commit e8e34d0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ PYSTRING_ADD_TEST(pystring, rfind)
PYSTRING_CHECK_EQUAL(pystring::rfind("abcabcabc", "abc", 6, 8), -1);
}

PYSTRING_ADD_TEST(pystring, removeprefix)
{
PYSTRING_CHECK_EQUAL(pystring::removeprefix("abcdef", "abc"), "def");
PYSTRING_CHECK_EQUAL(pystring::removeprefix("abcdef", "bcd"), "abcdef");
}

PYSTRING_ADD_TEST(pystring, removesuffix)
{
PYSTRING_CHECK_EQUAL(pystring::removesuffix("abcdef", "def"), "abc");
PYSTRING_CHECK_EQUAL(pystring::removesuffix("abcdef", "cde"), "abcdef");
}

PYSTRING_ADD_TEST(pystring, replace)
{
PYSTRING_CHECK_EQUAL(pystring::replace("abcdef", "foo", "bar"), "abcdef");
Expand Down

0 comments on commit e8e34d0

Please sign in to comment.