summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-01-16 15:15:16 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-01-16 05:50:08 +0000
commit65c1137757e394961808a29b5607ee0ed6977a34 (patch)
treef0f56d1b27fa01f29351bea160e98046de8ff636 /sal
parenteed4cc7933b2a46f421bb469652b85a58831b3c3 (diff)
sal: (rtl) test OUString::isEmpty()
Change-Id: If7a6eb598a1e121c1c74e520f7e2238016a3e6e0 Reviewed-on: https://gerrit.libreoffice.org/21506 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl/oustring/rtl_OUString2.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
index 7868b98c6464..0126f4db4616 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);