diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-14 09:46:50 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-14 11:16:15 +0100 |
commit | 8b66e1745933cd5aa4ae974f709a7e6c8be1f898 (patch) | |
tree | ee2c0e53dbb71680306a369641cc42a5d6176b20 /sal | |
parent | 4376820074abc4d70765675ef5a4adae8f58effe (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.cxx | 8 |
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(); |