diff options
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/rtl/strings/test_ostring_concat.cxx | 19 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_concat.cxx | 18 |
2 files changed, 31 insertions, 6 deletions
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx index c3a422a51f5f..4c0630c56351 100644 --- a/sal/qa/rtl/strings/test_ostring_concat.cxx +++ b/sal/qa/rtl/strings/test_ostring_concat.cxx @@ -12,6 +12,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <rtl/string.hxx> +#include <rtl/strbuf.hxx> #include <typeinfo> @@ -32,12 +33,14 @@ namespace test { namespace ostring { class StringConcat : public CppUnit::TestFixture { private: - void check(); + void checkConcat(); void checkEnsureCapacity(); + void checkAppend(); CPPUNIT_TEST_SUITE(StringConcat); -CPPUNIT_TEST(check); +CPPUNIT_TEST(checkConcat); CPPUNIT_TEST(checkEnsureCapacity); +CPPUNIT_TEST(checkAppend); CPPUNIT_TEST_SUITE_END(); }; @@ -46,7 +49,7 @@ CPPUNIT_TEST_SUITE_END(); #else #define TYPES_ASSERT_EQUAL( a, b ) #endif -void test::ostring::StringConcat::check() +void test::ostring::StringConcat::checkConcat() { // All the extra () are to protect commas againsts being treated as separators of macro arguments. CPPUNIT_ASSERT_EQUAL( OString(), OString(OString() + OString()) ); @@ -113,6 +116,16 @@ void test::ostring::StringConcat::checkEnsureCapacity() rtl_string_release( oldStr ); } +void test::ostring::StringConcat::checkAppend() +{ + OString str( "foo" ); + str += OStringLiteral( "bar" ) + "baz"; + CPPUNIT_ASSERT_EQUAL( OString( "foobarbaz" ), str ); + OStringBuffer buf( "foo" ); + buf.append( OStringLiteral( "bar" ) + "baz" ); + CPPUNIT_ASSERT_EQUAL( OString( "foobarbaz" ), buf.makeStringAndClear()); +} + }} // namespace CPPUNIT_TEST_SUITE_REGISTRATION(test::ostring::StringConcat); diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx index 108b166c6de2..8d98232a71a2 100644 --- a/sal/qa/rtl/strings/test_oustring_concat.cxx +++ b/sal/qa/rtl/strings/test_oustring_concat.cxx @@ -12,6 +12,7 @@ #include <cppunit/extensions/HelperMacros.h> #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> #include <typeinfo> @@ -32,12 +33,14 @@ namespace test { namespace oustring { class StringConcat : public CppUnit::TestFixture { private: - void check(); + void checkConcat(); void checkEnsureCapacity(); + void checkAppend(); CPPUNIT_TEST_SUITE(StringConcat); -CPPUNIT_TEST(check); +CPPUNIT_TEST(checkConcat); CPPUNIT_TEST(checkEnsureCapacity); +CPPUNIT_TEST(checkAppend); CPPUNIT_TEST_SUITE_END(); }; @@ -46,7 +49,7 @@ CPPUNIT_TEST_SUITE_END(); #else #define TYPES_ASSERT_EQUAL( a, b ) #endif -void test::oustring::StringConcat::check() +void test::oustring::StringConcat::checkConcat() { // All the extra () are to protect commas againsts being treated as separators of macro arguments. CPPUNIT_ASSERT_EQUAL( OUString(), OUString(OUString() + OUString()) ); @@ -105,6 +108,15 @@ void test::oustring::StringConcat::checkEnsureCapacity() rtl_uString_release( oldStr ); } +void test::oustring::StringConcat::checkAppend() +{ + OUString str( "foo" ); + str += OUStringLiteral( "bar" ) + "baz"; + CPPUNIT_ASSERT_EQUAL( OUString( "foobarbaz" ), str ); + OUStringBuffer buf( "foo" ); + buf.append( OUStringLiteral( "bar" ) + "baz" ); + CPPUNIT_ASSERT_EQUAL( OUString( "foobarbaz" ), buf.makeStringAndClear()); +} }} // namespace |