[Libreoffice-commits] .: sal/qa

Stephan Bergmann sbergmann at kemper.freedesktop.org
Mon Jul 16 01:37:51 PDT 2012


 sal/qa/rtl/strings/test_oustring_compare.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 4ad006fc76b0f7fdd267c64fc868aaf63e281a31
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 16 10:35:53 2012 +0200

    Confusing behavior of cmopareToAscii overloads
    
    Change-Id: If432b67cebdb9a009a015ddf046ed1ce15920e57

diff --git a/sal/qa/rtl/strings/test_oustring_compare.cxx b/sal/qa/rtl/strings/test_oustring_compare.cxx
index fe97845..e8e4c91 100644
--- a/sal/qa/rtl/strings/test_oustring_compare.cxx
+++ b/sal/qa/rtl/strings/test_oustring_compare.cxx
@@ -39,8 +39,11 @@ class Compare: public CppUnit::TestFixture
 private:
     void equalsIgnoreAsciiCaseAscii();
 
+    void compareToAscii();
+
 CPPUNIT_TEST_SUITE(Compare);
 CPPUNIT_TEST(equalsIgnoreAsciiCaseAscii);
+CPPUNIT_TEST(compareToAscii);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -66,4 +69,14 @@ void test::oustring::Compare::equalsIgnoreAsciiCaseAscii()
                    equalsIgnoreAsciiCaseAscii("abcd"));
 }
 
+void test::oustring::Compare::compareToAscii()
+{
+    // The different overloads of compareToAscii exhibit potentially confusing
+    // behavior:
+    rtl::OUString abc("abc");
+    CPPUNIT_ASSERT(abc.compareToAscii("a") > 0);
+    CPPUNIT_ASSERT_EQUAL(
+        0, abc.compareToAscii(RTL_CONSTASCII_STRINGPARAM("a")));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list