diff options
author | Tor Lillqvist <tml@collabora.com> | 2021-01-14 10:59:34 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2021-01-14 18:06:58 +0100 |
commit | 06ecfbe3d236e06f597e5422bfc24a9a76c3f90c (patch) | |
tree | 8dd90fd4eb614542c57bdd91c0e02cf8c2029362 /sal | |
parent | 51d9f9069a45030eec4f49b40f736ac4f97c0e9e (diff) |
Introduce startsWithAsciiL() to match endsWithAsciiL()
Will be used in an upcoming change. Unit test included.
Change-Id: I777a755cab543ea277b84fb5ad021d0b91725764
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109264
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/oustring/rtl_OUString2.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx index 516378dc14a7..d2223511f92a 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -881,6 +881,24 @@ void indexOfAscii::test() { sal_Int32(3), OUString("foofoobar").indexOf("foo", 1)); } +class startsWithAsciiL: public CppUnit::TestFixture { +public: + void test(); + + CPPUNIT_TEST_SUITE(startsWithAsciiL); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); +}; + +void startsWithAsciiL::test() { + CPPUNIT_ASSERT_EQUAL(true, OUString().startsWithAsciiL("", 0)); + CPPUNIT_ASSERT_EQUAL(false, OUString().startsWithAsciiL("x", 1)); + CPPUNIT_ASSERT_EQUAL(true, OUString("bar").startsWithAsciiL("bar", 3)); + CPPUNIT_ASSERT_EQUAL(false, OUString("bar").startsWithAsciiL("foobar", 6)); + CPPUNIT_ASSERT_EQUAL(true, OUString("foobar").startsWithAsciiL("foo", 3)); + CPPUNIT_ASSERT_EQUAL(false, OUString("FOOBAR").startsWithAsciiL("foo", 3)); +} + class endsWith: public CppUnit::TestFixture { public: void test(); @@ -1033,6 +1051,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::getToken); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::convertToString); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::construction); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::indexOfAscii); +CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::startsWithAsciiL); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::endsWith); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::isEmpty); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::createFromCodePoints); |