diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-04-06 13:45:47 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-04-06 13:46:21 +0200 |
commit | 066dbfd1970b8ea58ba16b07b2a57f61c0cb8e36 (patch) | |
tree | 635b7cdbca8b31e82fedbead441dfd298b53718b /sal/qa | |
parent | 7d82fb18fe6ae68f6eb6a33c6030105f9e2fe232 (diff) |
string literal O(U)StringBuffer ctors too, after all
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/rtl/strings/test_ostring_stringliterals.cxx | 6 | ||||
-rw-r--r-- | sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 21 |
2 files changed, 16 insertions, 11 deletions
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx index d7e3cf5be7c4..2baac11c742b 100644 --- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx @@ -83,12 +83,15 @@ CPPUNIT_TEST_SUITE_END(); ( \ rtl_string_unittest_const_literal = false, \ ( void ) rtl::OString( argument ), \ - rtl_string_unittest_const_literal ) + result_tmp = rtl_string_unittest_const_literal, \ + ( void ) rtl::OStringBuffer( argument ), \ + rtl_string_unittest_const_literal && result_tmp ) void test::ostring::StringLiterals::checkCtors() { // string literal ctors do not work with SFINAE broken and are disabled #ifndef HAVE_SFINAE_ANONYMOUS_BROKEN + bool result_tmp; CPPUNIT_ASSERT( CONST_CTOR_USED( "test" )); const char good1[] = "test"; CPPUNIT_ASSERT( CONST_CTOR_USED( good1 )); @@ -144,6 +147,7 @@ char test::ostring::StringLiterals::bad6[] = "test"; void test::ostring::StringLiterals::testcall( const char str[] ) { #ifndef _MSC_VER + bool result_tmp; CPPUNIT_ASSERT( !CONST_CTOR_USED( str )); #else // MSVC just errors out on this for some reason, which is fine as well diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index 631647858927..82e76ea14b70 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -70,32 +70,33 @@ CPPUNIT_TEST_SUITE_END(); #define VALID_CONVERSION( expression ) \ ( \ rtl_string_unittest_invalid_conversion = false, \ - ( void ) ( expression ), \ + ( void ) rtl::OUString( expression ), \ + ( void ) rtl::OUStringBuffer( expression ), \ !rtl_string_unittest_invalid_conversion ) void test::oustring::StringLiterals::checkCtors() { - CPPUNIT_ASSERT( VALID_CONVERSION( rtl::OUString( "test" ))); + CPPUNIT_ASSERT( VALID_CONVERSION( "test" )); const char good1[] = "test"; - CPPUNIT_ASSERT( VALID_CONVERSION( rtl::OUString( good1 ))); + CPPUNIT_ASSERT( VALID_CONVERSION( good1 )); - CPPUNIT_ASSERT( !VALID_CONVERSION( rtl::OUString( (const char*) "test" ))); + CPPUNIT_ASSERT( !VALID_CONVERSION( (const char*) "test" )); const char* bad1 = good1; - CPPUNIT_ASSERT( !VALID_CONVERSION( rtl::OUString( bad1 ))); + CPPUNIT_ASSERT( !VALID_CONVERSION( bad1 )); char bad2[] = "test"; - CPPUNIT_ASSERT( !VALID_CONVERSION( rtl::OUString( bad2 ))); + CPPUNIT_ASSERT( !VALID_CONVERSION( bad2 )); char* bad3 = bad2; - CPPUNIT_ASSERT( !VALID_CONVERSION( rtl::OUString( bad3 ))); + CPPUNIT_ASSERT( !VALID_CONVERSION( bad3 )); const char* bad4[] = { "test1" }; - CPPUNIT_ASSERT( !VALID_CONVERSION( rtl::OUString( bad4[ 0 ] ))); + CPPUNIT_ASSERT( !VALID_CONVERSION( bad4[ 0 ] )); testcall( good1 ); // This one is technically broken, since the first element is 6 characters test\0\0, // but there does not appear a way to detect this by compile time (runtime will complain). // RTL_CONSTASCII_USTRINGPARAM() has the same flaw. const char bad5[][ 6 ] = { "test", "test2" }; -// CPPUNIT_ASSERT( VALID_CONVERSION( rtl::OUString( bad5[ 0 ] ))); - CPPUNIT_ASSERT( VALID_CONVERSION( rtl::OUString( bad5[ 1 ] ))); +// CPPUNIT_ASSERT( VALID_CONVERSION( bad5[ 0 ] )); + CPPUNIT_ASSERT( VALID_CONVERSION( bad5[ 1 ] )); // Check that contents are correct and equal to the case when RTL_CONSTASCII_USTRINGPARAM is used. // Also check that embedded \0 is included. |