[Libreoffice-commits] core.git: sal/qa

Chris Sherlock chris.sherlock79 at gmail.com
Fri Jan 15 21:50:34 PST 2016


 sal/qa/rtl/oustring/rtl_OUString2.cxx |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

New commits:
commit 65c1137757e394961808a29b5607ee0ed6977a34
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Jan 16 15:15:16 2016 +1100

    sal: (rtl) test OUString::isEmpty()
    
    Change-Id: If7a6eb598a1e121c1c74e520f7e2238016a3e6e0
    Reviewed-on: https://gerrit.libreoffice.org/21506
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>

diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
index 7868b98..0126f4d 100644
--- a/sal/qa/rtl/oustring/rtl_OUString2.cxx
+++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx
@@ -983,6 +983,31 @@ void endsWith::test() {
             RTL_CONSTASCII_STRINGPARAM("bar")));
 }
 
+class isEmpty: public CppUnit::TestFixture {
+public:
+    void test();
+
+    CPPUNIT_TEST_SUITE(isEmpty);
+    CPPUNIT_TEST(test);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void isEmpty::test() {
+    OUString aString;
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Newly constructed string should be empty", true, aString.isEmpty() );
+
+    aString = "Not empty any more";
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "String should not be empty", false, aString.isEmpty() );
+
+    aString.clear();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "aString.clear(), so should now be empty", true, aString.isEmpty() );
+
+    aString = "Not empty any more";
+    aString = "";
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "aString = \"\", so should now be empty", true, aString.isEmpty() );
+}
+
+
 class createFromCodePoints: public CppUnit::TestFixture {
 public:
     void test();
@@ -1098,6 +1123,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::convertToString);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::construction);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::indexOfAscii);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::endsWith);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::isEmpty);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::createFromCodePoints);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::iterateCodePoints);
 CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OUString::convertFromString);


More information about the Libreoffice-commits mailing list