diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-03-09 11:25:54 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-03-09 14:04:03 +0100 |
commit | dcd5fa0a7b896fd585ef964cf62ae70d247250f1 (patch) | |
tree | ef51bf00d1fe6b09dd21f701a3c423d7e4ec4560 /sal/qa/rtl | |
parent | dd4dbc70d413ada95632eb818b4d435a14e87303 (diff) |
Drop misguided test added in 82a1d32d3d3ac1b4b0a6d4cfaca791c77d9b3c03
The documented precondition is that index must not be greater than
the length of string. Just assert that, and fix the found misuse.
The added test is for in-place replacement, just in case.
Change-Id: I3c545a6f0bf913fe93e2bef83ce733359c193065
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131232
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sal/qa/rtl')
-rw-r--r-- | sal/qa/rtl/oustring/rtl_OUString2.cxx | 9 | ||||
-rw-r--r-- | sal/qa/rtl/oustring/rtl_ustr.cxx | 10 |
2 files changed, 7 insertions, 12 deletions
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx index 5f68629a4c09..22e731fd16f1 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -794,14 +794,6 @@ public: // should not GPF with negative index } - void getToken_007() - { - OUString suTokenStr("a;b"); - sal_Int32 n = 5; // greater than string length - CPPUNIT_ASSERT_EQUAL(OUString(), suTokenStr.getToken(0, ';', n)); - CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), n); - } - CPPUNIT_TEST_SUITE(getToken); CPPUNIT_TEST(getToken_000); CPPUNIT_TEST(getToken_001); @@ -810,7 +802,6 @@ public: CPPUNIT_TEST(getToken_004); CPPUNIT_TEST(getToken_005); CPPUNIT_TEST(getToken_006); - CPPUNIT_TEST(getToken_007); CPPUNIT_TEST_SUITE_END(); }; // class getToken diff --git a/sal/qa/rtl/oustring/rtl_ustr.cxx b/sal/qa/rtl/oustring/rtl_ustr.cxx index 873d771f9457..f5c405dfd948 100644 --- a/sal/qa/rtl/oustring/rtl_ustr.cxx +++ b/sal/qa/rtl/oustring/rtl_ustr.cxx @@ -1031,9 +1031,13 @@ namespace rtl_ustr class getToken : public CppUnit::TestFixture { void getToken_000() - { - // TODO - } + { + OUString s("a;b;c"); + // Replace the string in place + const sal_Int32 i = rtl_uString_getToken(&s.pData, s.pData, 1, ';', 0); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), i); + CPPUNIT_ASSERT_EQUAL(OUString("b"), s); + } CPPUNIT_TEST_SUITE(getToken); CPPUNIT_TEST(getToken_000); |