Skip to content

Commit e85bfc9

Browse files
committed
#157 - Test CppStringT::removeprefix() with char and wchar_t
Completed.
1 parent 98a85fb commit e85bfc9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

cpp-strings-tests/cpp-strings-tests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,5 +876,22 @@ namespace cppstringstests
876876
Assert::AreEqual(L"", wres[2].c_str());
877877
}
878878

879+
TEST_METHOD(removeprefix)
880+
{
881+
pcs::CppString s("abcd");
882+
Assert::AreEqual("cd", s.removeprefix("ab").c_str());
883+
Assert::AreEqual("abcd", s.removeprefix("ba").c_str());
884+
Assert::AreEqual("abcd", s.removeprefix("").c_str());
885+
Assert::AreEqual("abaabcd", "abbabaabcd"cs.removeprefix("abb").c_str());
886+
Assert::AreEqual("cdab", "abcdab"cs.removeprefix("ab").c_str());
887+
888+
pcs::CppWString ws(L"abcd");
889+
Assert::AreEqual(L"cd", ws.removeprefix(L"ab").c_str());
890+
Assert::AreEqual(L"abcd", ws.removeprefix(L"ba").c_str());
891+
Assert::AreEqual(L"abcd", ws.removeprefix(L"").c_str());
892+
Assert::AreEqual(L"abaabcd", L"abbabaabcd"cs.removeprefix(L"abb").c_str());
893+
Assert::AreEqual(L"cdab", L"abcdab"cs.removeprefix(L"ab").c_str());
894+
}
895+
879896
};
880897
}

0 commit comments

Comments
 (0)