summaryrefslogtreecommitdiff
path: root/sal/qa/rtl/oustringbuffer
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-11-03 16:08:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-11-04 08:21:24 +0100
commitfb17dce09e29c4518129587d347cc3787f74c396 (patch)
tree86c88a45ca5332ad315e6aa0d33a21d1ed0e2cf3 /sal/qa/rtl/oustringbuffer
parent08488edd45b7b4fa6b255c4a3e5b882765e6fc13 (diff)
Added OUStringBuffer::append(char) so that b.append(' ') does what one expects.
Diffstat (limited to 'sal/qa/rtl/oustringbuffer')
-rw-r--r--sal/qa/rtl/oustringbuffer/makefile.mk1
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx63
2 files changed, 64 insertions, 0 deletions
diff --git a/sal/qa/rtl/oustringbuffer/makefile.mk b/sal/qa/rtl/oustringbuffer/makefile.mk
index 80cff0885b75..5e729691b4fa 100644
--- a/sal/qa/rtl/oustringbuffer/makefile.mk
+++ b/sal/qa/rtl/oustringbuffer/makefile.mk
@@ -46,6 +46,7 @@ CFLAGSCXX += $(CPPUNIT_CFLAGS)
SHL1TARGET := $(TARGET)
SHL1OBJS := \
+ $(SLO)$/test_oustringbuffer_appendchar.obj \
$(SLO)$/test_oustringbuffer_utf32.obj \
$(SLO)$/test_oustringbuffer_tostring.obj \
$(SLO)$/test_oustringbuffer_noadditional.obj
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
new file mode 100644
index 000000000000..f936aecd96a1
--- /dev/null
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Stephan Bergmann, Red Hat <sbergman@redhat.com> (initial
+ * developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "precompiled_sal.hxx"
+#include "sal/config.h"
+#include "sal/precppunit.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/TestAssert.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "rtl/ustrbuf.hxx"
+
+namespace test { namespace oustringbuffer {
+
+class AppendChar: public CppUnit::TestFixture {
+private:
+ void testAppendChar();
+
+ CPPUNIT_TEST_SUITE(AppendChar);
+ CPPUNIT_TEST(testAppendChar);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void AppendChar::testAppendChar() {
+ // Check that append('a') does not unexpectedly pick
+ // append(sal_Int32 i, sal_Int16 radix = 10):
+ rtl::OUStringBuffer s;
+ s.append('a');
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength());
+ CPPUNIT_ASSERT_EQUAL(sal_Unicode('a'), s[0]);
+}
+
+} }
+
+CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::AppendChar);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */