diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/strings/test_ostring.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sal/qa/rtl/strings/test_ostring.cxx b/sal/qa/rtl/strings/test_ostring.cxx index cd2e0a22bb99..110831758916 100644 --- a/sal/qa/rtl/strings/test_ostring.cxx +++ b/sal/qa/rtl/strings/test_ostring.cxx @@ -20,10 +20,12 @@ class Test: public CppUnit::TestFixture { private: void testStartsWithIgnoreAsciiCase(); void testCompareTo(); + void testUtf8StringLiterals(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testStartsWithIgnoreAsciiCase); CPPUNIT_TEST(testCompareTo); + CPPUNIT_TEST(testUtf8StringLiterals); CPPUNIT_TEST_SUITE_END(); }; @@ -105,6 +107,15 @@ void Test::testCompareTo() CPPUNIT_ASSERT(OString(s2 + "y").compareTo(s1) > 0); } +void Test::testUtf8StringLiterals() +{ + const OString sIn(u8"ßa"); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sIn.getLength()); + CPPUNIT_ASSERT_EQUAL(-61, static_cast<int>(sIn[0])); + CPPUNIT_ASSERT_EQUAL(-97, static_cast<int>(sIn[1])); + CPPUNIT_ASSERT_EQUAL(97, static_cast<int>(sIn[2])); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } |