Skip to content

Commit e8e34d0

Browse files
committed
Add tests for removeprefix and removesuffix
1 parent 5a0840a commit e8e34d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ PYSTRING_ADD_TEST(pystring, rfind)
9494
PYSTRING_CHECK_EQUAL(pystring::rfind("abcabcabc", "abc", 6, 8), -1);
9595
}
9696

97+
PYSTRING_ADD_TEST(pystring, removeprefix)
98+
{
99+
PYSTRING_CHECK_EQUAL(pystring::removeprefix("abcdef", "abc"), "def");
100+
PYSTRING_CHECK_EQUAL(pystring::removeprefix("abcdef", "bcd"), "abcdef");
101+
}
102+
103+
PYSTRING_ADD_TEST(pystring, removesuffix)
104+
{
105+
PYSTRING_CHECK_EQUAL(pystring::removesuffix("abcdef", "def"), "abc");
106+
PYSTRING_CHECK_EQUAL(pystring::removesuffix("abcdef", "cde"), "abcdef");
107+
}
108+
97109
PYSTRING_ADD_TEST(pystring, replace)
98110
{
99111
PYSTRING_CHECK_EQUAL(pystring::replace("abcdef", "foo", "bar"), "abcdef");

0 commit comments

Comments
 (0)