summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-14 09:46:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-14 11:16:15 +0100
commit8b66e1745933cd5aa4ae974f709a7e6c8be1f898 (patch)
treeee2c0e53dbb71680306a369641cc42a5d6176b20 /sal
parent4376820074abc4d70765675ef5a4adae8f58effe (diff)
Add empty OUStringBuffer::toString test
...motivated by <https://gerrit.libreoffice.org/c/core/+/107643> "Don't crash on an empty OUStringBuffer::toString" Change-Id: I144f0814f585f56df3fcdc818fd8c5e18ad08115 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107672 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
index 66231d8b856f..d942480d1748 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
@@ -28,9 +28,11 @@ namespace test::oustringbuffer {
class ToString: public CppUnit::TestFixture {
private:
+ void testEmptyToString();
void testToString();
CPPUNIT_TEST_SUITE(ToString);
+ CPPUNIT_TEST(testEmptyToString);
CPPUNIT_TEST(testToString);
CPPUNIT_TEST_SUITE_END();
};
@@ -39,6 +41,12 @@ private:
CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::ToString);
+void test::oustringbuffer::ToString::testEmptyToString() {
+ OUStringBuffer sb;
+ OUString str = sb.toString();
+ CPPUNIT_ASSERT_EQUAL(OUString(), str);
+}
+
void test::oustringbuffer::ToString::testToString() {
OUStringBuffer sb("test string");
OUString str = sb.toString();