diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-12-17 16:37:41 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-12-17 16:39:33 +0100 |
commit | d0ec8c49017b07862f8228c039bebe348eb28b0c (patch) | |
tree | 2784cb46d03901cd6c411d2f70f6f243cad6d8a6 /sal | |
parent | 0f5e9170248df98ef7c7c6d475ff7d2bb9fa2214 (diff) |
rtl::OUStringLiteral to the rescue
...for cases where ? "a" : "bb" does not work, as well as to work around the
MSVC bug for cases like ? "a" : "b".
Change-Id: Id404716047aca5cc81440f291616d92365379b8f
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index 0693fc2a3e08..0848db19011a 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -31,6 +31,7 @@ private: void checkExtraIntArgument(); void checkNonconstChar(); void checkBuffer(); + void checkOUStringLiteral(); void checkOUStringLiteral1(); void testcall( const char str[] ); @@ -41,6 +42,7 @@ CPPUNIT_TEST(checkUsage); CPPUNIT_TEST(checkExtraIntArgument); CPPUNIT_TEST(checkNonconstChar); CPPUNIT_TEST(checkBuffer); +CPPUNIT_TEST(checkOUStringLiteral); CPPUNIT_TEST(checkOUStringLiteral1); CPPUNIT_TEST_SUITE_END(); }; @@ -172,6 +174,22 @@ void test::oustring::StringLiterals::checkBuffer() CPPUNIT_ASSERT( !VALID_CONVERSION( buf.append( rtl::OUStringBuffer( d )))); } +namespace { + +rtl::OUString conditional(bool flag) { + return flag + ? rtlunittest::OUStringLiteral("a") + : rtlunittest::OUStringLiteral("bb"); +} + +} + +void test::oustring::StringLiterals::checkOUStringLiteral() +{ + CPPUNIT_ASSERT(conditional(true) == "a"); + CPPUNIT_ASSERT(conditional(false) == "bb"); +} + void test::oustring::StringLiterals::checkOUStringLiteral1() { rtl::OUString s1; |