From db9104a366a57cc66f87467af8a329772d3f3b52 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Sun, 19 Nov 2023 13:25:00 +0100 Subject: [PATCH] Extended loplugin:ostr: tools Change-Id: I70df74d005c7fca14b1bcb70f4870023bd3af4a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159668 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- tools/qa/cppunit/test_config.cxx | 70 +++++++++++++-------------- tools/qa/cppunit/test_guid.cxx | 2 +- tools/qa/cppunit/test_inetmime.cxx | 28 +++++------ tools/qa/cppunit/test_json_writer.cxx | 12 ++--- tools/qa/cppunit/test_stream.cxx | 20 ++++---- tools/qa/cppunit/test_xmlwalker.cxx | 20 ++++---- tools/qa/cppunit/test_xmlwriter.cxx | 6 +-- tools/qa/cppunit/test_zcodec.cxx | 2 +- 8 files changed, 80 insertions(+), 80 deletions(-) diff --git a/tools/qa/cppunit/test_config.cxx b/tools/qa/cppunit/test_config.cxx index 9c9a40899876..d54a2a93d5b7 100644 --- a/tools/qa/cppunit/test_config.cxx +++ b/tools/qa/cppunit/test_config.cxx @@ -46,26 +46,26 @@ public: void testGetGroup() { Config aConfig(maConfigFile); - CPPUNIT_ASSERT_EQUAL(OString(""), aConfig.GetGroup()); + CPPUNIT_ASSERT_EQUAL(""_ostr, aConfig.GetGroup()); - CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroupName(0)); - CPPUNIT_ASSERT_EQUAL(OString("TestGroup2"), aConfig.GetGroupName(1)); - CPPUNIT_ASSERT_EQUAL(OString(""), aConfig.GetGroupName(2)); + CPPUNIT_ASSERT_EQUAL("TestGroup"_ostr, aConfig.GetGroupName(0)); + CPPUNIT_ASSERT_EQUAL("TestGroup2"_ostr, aConfig.GetGroupName(1)); + CPPUNIT_ASSERT_EQUAL(""_ostr, aConfig.GetGroupName(2)); } void testSetGroup() { Config aConfig(maConfigFile); - aConfig.SetGroup("TestGroup"); - CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroup()); + aConfig.SetGroup("TestGroup"_ostr); + CPPUNIT_ASSERT_EQUAL("TestGroup"_ostr, aConfig.GetGroup()); // so this is a quirk of Config - you can set the group name, // but it might not exist so you really should first check if // it exists via HasGroup() - aConfig.SetGroup("TestGroupA"); + aConfig.SetGroup("TestGroupA"_ostr); CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroupA")); - CPPUNIT_ASSERT_EQUAL(OString("TestGroupA"), aConfig.GetGroup()); + CPPUNIT_ASSERT_EQUAL("TestGroupA"_ostr, aConfig.GetGroup()); } void testDeleteGroup() @@ -75,7 +75,7 @@ public: aConfig.DeleteGroup("TestGroup"); CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroup")); - CPPUNIT_ASSERT_EQUAL(OString("TestGroup2"), aConfig.GetGroupName(0)); + CPPUNIT_ASSERT_EQUAL("TestGroup2"_ostr, aConfig.GetGroupName(0)); sal_uInt16 nActual = aConfig.GetGroupCount(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), nActual); @@ -88,7 +88,7 @@ public: CPPUNIT_ASSERT(!aConfig.HasGroup("NonExistentTestGroup")); aConfig.DeleteGroup("NonExistentTestGroup"); - CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), aConfig.GetGroupName(0)); + CPPUNIT_ASSERT_EQUAL("TestGroup"_ostr, aConfig.GetGroupName(0)); sal_uInt16 nActual = aConfig.GetGroupCount(); CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), nActual); @@ -107,69 +107,69 @@ public: void testReadKey() { Config aConfig(maConfigFile); - aConfig.SetGroup("TestGroup"); - CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey("testkey")); - CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("nonexistenttestkey")); - CPPUNIT_ASSERT_EQUAL(OString("notexists"), - aConfig.ReadKey("nonexistenttestkey", "notexists")); + aConfig.SetGroup("TestGroup"_ostr); + CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey"_ostr)); + CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("nonexistenttestkey"_ostr)); + CPPUNIT_ASSERT_EQUAL("notexists"_ostr, + aConfig.ReadKey("nonexistenttestkey"_ostr, "notexists"_ostr)); - aConfig.SetGroup("TestGroup2"); - CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey("testkey2")); - CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("nonexistenttestkey")); - CPPUNIT_ASSERT_EQUAL(OString("notexists"), - aConfig.ReadKey("nonexistenttestkey", "notexists")); + aConfig.SetGroup("TestGroup2"_ostr); + CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey2"_ostr)); + CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("nonexistenttestkey"_ostr)); + CPPUNIT_ASSERT_EQUAL("notexists"_ostr, + aConfig.ReadKey("nonexistenttestkey"_ostr, "notexists"_ostr)); } void testGetKeyName() { Config aConfig(maConfigFile); - aConfig.SetGroup("TestGroup"); - CPPUNIT_ASSERT_EQUAL(OString("testkey"), aConfig.GetKeyName(0)); + aConfig.SetGroup("TestGroup"_ostr); + CPPUNIT_ASSERT_EQUAL("testkey"_ostr, aConfig.GetKeyName(0)); - aConfig.SetGroup("TestGroup2"); - CPPUNIT_ASSERT_EQUAL(OString("testkey2"), aConfig.GetKeyName(0)); + aConfig.SetGroup("TestGroup2"_ostr); + CPPUNIT_ASSERT_EQUAL("testkey2"_ostr, aConfig.GetKeyName(0)); } void testWriteDeleteKey() { Config aConfig(maConfigFile); - aConfig.SetGroup("TestGroup"); - aConfig.WriteKey("testkey_new", "testvalue"); + aConfig.SetGroup("TestGroup"_ostr); + aConfig.WriteKey("testkey_new"_ostr, "testvalue"_ostr); sal_uInt16 nExpected = 2; sal_uInt16 nActual = aConfig.GetKeyCount(); CPPUNIT_ASSERT_EQUAL(nExpected, nActual); - CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey("testkey_new")); + CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey_new"_ostr)); aConfig.DeleteKey("testkey_new"); nExpected = 1; nActual = aConfig.GetKeyCount(); CPPUNIT_ASSERT_EQUAL(nExpected, nActual); - CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("testkey_new")); + CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("testkey_new"_ostr)); - aConfig.SetGroup("TestGroup2"); - aConfig.WriteKey("testkey_new", "testvalue"); + aConfig.SetGroup("TestGroup2"_ostr); + aConfig.WriteKey("testkey_new"_ostr, "testvalue"_ostr); nActual = aConfig.GetKeyCount(); nExpected = 2; CPPUNIT_ASSERT_EQUAL(nExpected, nActual); - CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey("testkey_new")); + CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey_new"_ostr)); aConfig.DeleteKey("testkey_new"); nActual = aConfig.GetKeyCount(); nExpected = 1; CPPUNIT_ASSERT_EQUAL(nExpected, nActual); - CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("testkey_new")); + CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("testkey_new"_ostr)); - aConfig.SetGroup("TestGroup3"); - aConfig.WriteKey("testkey_new_group3", "testvalue"); + aConfig.SetGroup("TestGroup3"_ostr); + aConfig.WriteKey("testkey_new_group3"_ostr, "testvalue"_ostr); nActual = aConfig.GetKeyCount(); nExpected = 1; CPPUNIT_ASSERT_EQUAL(nExpected, nActual); - CPPUNIT_ASSERT_EQUAL(OString("testvalue"), aConfig.ReadKey("testkey_new_group3")); + CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey_new_group3"_ostr)); nExpected = 3; CPPUNIT_ASSERT_EQUAL(nExpected, aConfig.GetGroupCount()); diff --git a/tools/qa/cppunit/test_guid.cxx b/tools/qa/cppunit/test_guid.cxx index 177e58591ba7..f16eb389319c 100644 --- a/tools/qa/cppunit/test_guid.cxx +++ b/tools/qa/cppunit/test_guid.cxx @@ -21,7 +21,7 @@ public: { sal_uInt8 pArray[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; Guid aGuid(pArray); - CPPUNIT_ASSERT_EQUAL(OString("{01020304-0506-0708-090A-0B0C0D0E0F10}"), aGuid.getString()); + CPPUNIT_ASSERT_EQUAL("{01020304-0506-0708-090A-0B0C0D0E0F10}"_ostr, aGuid.getString()); } void testCreate() diff --git a/tools/qa/cppunit/test_inetmime.cxx b/tools/qa/cppunit/test_inetmime.cxx index 958cfad77f2d..d079f19cf22f 100644 --- a/tools/qa/cppunit/test_inetmime.cxx +++ b/tools/qa/cppunit/test_inetmime.cxx @@ -76,13 +76,13 @@ namespace CPPUNIT_ASSERT_EQUAL(OUString("subtst"), subType); CPPUNIT_ASSERT_EQUAL( INetContentTypeParameterList::size_type(2), parameters.size()); - auto i = parameters.find("parm1"); + auto i = parameters.find("parm1"_ostr); CPPUNIT_ASSERT(i != parameters.end()); CPPUNIT_ASSERT_EQUAL(OString(), i->second.m_sCharset); CPPUNIT_ASSERT_EQUAL(OString(), i->second.m_sLanguage); CPPUNIT_ASSERT_EQUAL(OUString("Value1"), i->second.m_sValue); CPPUNIT_ASSERT(i->second.m_bConverted); - i = parameters.find("parm2"); + i = parameters.find("parm2"_ostr); CPPUNIT_ASSERT(i != parameters.end()); CPPUNIT_ASSERT_EQUAL(OString(), i->second.m_sCharset); CPPUNIT_ASSERT_EQUAL(OString(), i->second.m_sLanguage); @@ -114,10 +114,10 @@ namespace CPPUNIT_ASSERT_EQUAL(OUString("subtst"), subType); CPPUNIT_ASSERT_EQUAL( INetContentTypeParameterList::size_type(1), parameters.size()); - auto i = parameters.find("parm1"); + auto i = parameters.find("parm1"_ostr); CPPUNIT_ASSERT(i != parameters.end()); - CPPUNIT_ASSERT_EQUAL(OString("us-ascii"), i->second.m_sCharset); - CPPUNIT_ASSERT_EQUAL(OString("en"), i->second.m_sLanguage); + CPPUNIT_ASSERT_EQUAL("us-ascii"_ostr, i->second.m_sCharset); + CPPUNIT_ASSERT_EQUAL("en"_ostr, i->second.m_sLanguage); CPPUNIT_ASSERT_EQUAL(OUString("5% of 10 = 0.5"), i->second.m_sValue); CPPUNIT_ASSERT(i->second.m_bConverted); @@ -141,23 +141,23 @@ namespace CPPUNIT_ASSERT_EQUAL(OUString("subtst"), subType); CPPUNIT_ASSERT_EQUAL( INetContentTypeParameterList::size_type(3), parameters.size()); - i = parameters.find("parm1"); + i = parameters.find("parm1"_ostr); CPPUNIT_ASSERT(i != parameters.end()); - CPPUNIT_ASSERT_EQUAL(OString("us-ascii"), i->second.m_sCharset); - CPPUNIT_ASSERT_EQUAL(OString("en"), i->second.m_sLanguage); + CPPUNIT_ASSERT_EQUAL("us-ascii"_ostr, i->second.m_sCharset); + CPPUNIT_ASSERT_EQUAL("en"_ostr, i->second.m_sLanguage); CPPUNIT_ASSERT_EQUAL(OUString("value1"), i->second.m_sValue); CPPUNIT_ASSERT(i->second.m_bConverted); - i = parameters.find("parm2"); + i = parameters.find("parm2"_ostr); CPPUNIT_ASSERT(i != parameters.end()); - CPPUNIT_ASSERT_EQUAL(OString("windows-1250"), i->second.m_sCharset); - CPPUNIT_ASSERT_EQUAL(OString("en-gb"), i->second.m_sLanguage); + CPPUNIT_ASSERT_EQUAL("windows-1250"_ostr, i->second.m_sCharset); + CPPUNIT_ASSERT_EQUAL("en-gb"_ostr, i->second.m_sLanguage); // Euro currency sign, windows-1250 x80 is converted to unicode u20AC: CPPUNIT_ASSERT_EQUAL(u"value2 \u20AC"_ustr, i->second.m_sValue); CPPUNIT_ASSERT(i->second.m_bConverted); - i = parameters.find("parm3"); + i = parameters.find("parm3"_ostr); CPPUNIT_ASSERT(i != parameters.end()); - CPPUNIT_ASSERT_EQUAL(OString("unknown"), i->second.m_sCharset); - CPPUNIT_ASSERT_EQUAL(OString("en"), i->second.m_sLanguage); + CPPUNIT_ASSERT_EQUAL("unknown"_ostr, i->second.m_sCharset); + CPPUNIT_ASSERT_EQUAL("en"_ostr, i->second.m_sLanguage); // Conversion fails for unknown charsets: CPPUNIT_ASSERT(!i->second.m_bConverted); } diff --git a/tools/qa/cppunit/test_json_writer.cxx b/tools/qa/cppunit/test_json_writer.cxx index b3d66fe92b03..a82fc769be31 100644 --- a/tools/qa/cppunit/test_json_writer.cxx +++ b/tools/qa/cppunit/test_json_writer.cxx @@ -45,8 +45,8 @@ void JsonWriterTest::test1() OString result(aJson.finishAndGetAsOString()); - CPPUNIT_ASSERT_EQUAL(OString("{ \"node\": { \"oustring\": \"val1\", " - "\"charptr\": \"val3\", \"int\": 12}}"), + CPPUNIT_ASSERT_EQUAL("{ \"node\": { \"oustring\": \"val1\", " + "\"charptr\": \"val3\", \"int\": 12}}"_ostr, result); } @@ -71,9 +71,9 @@ void JsonWriterTest::test2() OString result(aJson.finishAndGetAsOString()); - CPPUNIT_ASSERT_EQUAL(OString("{ \"node\": { \"field1\": \"val1\", \"field2\": \"val2\", " - "\"node\": { \"field3\": \"val3\", \"node\": { \"field4\": " - "\"val4\", \"field5\": \"val5\"}}}}"), + CPPUNIT_ASSERT_EQUAL("{ \"node\": { \"field1\": \"val1\", \"field2\": \"val2\", " + "\"node\": { \"field3\": \"val3\", \"node\": { \"field4\": " + "\"val4\", \"field5\": \"val5\"}}}}"_ostr, result); } @@ -88,7 +88,7 @@ void JsonWriterTest::testArray() OString aResult(aJson.finishAndGetAsOString()); - CPPUNIT_ASSERT_EQUAL(OString("{ \"items\": [ \"foo\", \"bar\"]}"), aResult); + CPPUNIT_ASSERT_EQUAL("{ \"items\": [ \"foo\", \"bar\"]}"_ostr, aResult); } CPPUNIT_TEST_SUITE_REGISTRATION(JsonWriterTest); diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx index f6103e24fa01..edec9c0fb7b3 100644 --- a/tools/qa/cppunit/test_stream.cxx +++ b/tools/qa/cppunit/test_stream.cxx @@ -140,10 +140,10 @@ namespace SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ); OString aOne = read_uInt8s_ToOString(aMemStream, 3); - CPPUNIT_ASSERT_EQUAL(OString("foo"), aOne); + CPPUNIT_ASSERT_EQUAL("foo"_ostr, aOne); OString aTwo = read_uInt8s_ToOString(aMemStream, 3); - CPPUNIT_ASSERT_EQUAL(OString("bar"), aTwo); + CPPUNIT_ASSERT_EQUAL("bar"_ostr, aTwo); OString aThree = read_uInt8s_ToOString(aMemStream, 3); CPPUNIT_ASSERT(aThree.isEmpty()); @@ -160,7 +160,7 @@ namespace SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ); OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT_EQUAL(OString("foobar"), aOne); + CPPUNIT_ASSERT_EQUAL("foobar"_ostr, aOne); CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(aMemStream.eof()); @@ -168,7 +168,7 @@ namespace aMemStream.Seek(0); foo[3] = 0; OString aTwo = read_zeroTerminated_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT_EQUAL(OString("foo"), aTwo); + CPPUNIT_ASSERT_EQUAL("foo"_ostr, aTwo); CPPUNIT_ASSERT(aMemStream.good()); } @@ -178,7 +178,7 @@ namespace SvMemoryStream aMemStream(foo, SAL_N_ELEMENTS(foo)-1, StreamMode::READ); OString aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT_EQUAL(OString("foo"), aFoo); + CPPUNIT_ASSERT_EQUAL("foo"_ostr, aFoo); CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.eof()); @@ -186,7 +186,7 @@ namespace aMemStream.Seek(0); foo[0] = 10; aFoo = read_uInt8_lenPrefixed_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT_EQUAL(OString("foobar"), aFoo); + CPPUNIT_ASSERT_EQUAL("foobar"_ostr, aFoo); CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(aMemStream.eof()); @@ -196,7 +196,7 @@ namespace foo[0] = 0; foo[1] = 3; aFoo = read_uInt16_lenPrefixed_uInt8s_ToOString(aMemStream); - CPPUNIT_ASSERT_EQUAL(OString("oob"), aFoo); + CPPUNIT_ASSERT_EQUAL("oob"_ostr, aFoo); CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.bad()); CPPUNIT_ASSERT(!aMemStream.eof()); @@ -212,12 +212,12 @@ namespace bRet = aMemStream.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); - CPPUNIT_ASSERT_EQUAL(OString("foo"), aFoo); + CPPUNIT_ASSERT_EQUAL("foo"_ostr, aFoo); CPPUNIT_ASSERT(aMemStream.good()); bRet = aMemStream.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); - CPPUNIT_ASSERT_EQUAL(OString("bar"), aFoo); + CPPUNIT_ASSERT_EQUAL("bar"_ostr, aFoo); CPPUNIT_ASSERT(aMemStream.good()); bRet = aMemStream.ReadLine(aFoo); @@ -271,7 +271,7 @@ namespace SvMemoryStream aMemStreamB(bar, SAL_N_ELEMENTS(bar)-1, StreamMode::READ); bRet = aMemStreamB.ReadLine(aFoo); CPPUNIT_ASSERT(bRet); - CPPUNIT_ASSERT_EQUAL(OString("foo"), aFoo); + CPPUNIT_ASSERT_EQUAL("foo"_ostr, aFoo); CPPUNIT_ASSERT(!aMemStreamB.eof()); //<-- diff A std::istringstream issB(bar, std::istringstream::in); diff --git a/tools/qa/cppunit/test_xmlwalker.cxx b/tools/qa/cppunit/test_xmlwalker.cxx index ec0a695b62d1..6df278c21e2e 100644 --- a/tools/qa/cppunit/test_xmlwalker.cxx +++ b/tools/qa/cppunit/test_xmlwalker.cxx @@ -41,8 +41,8 @@ void XmlWalkerTest::testReadXML() tools::XmlWalker aWalker; SvFileStream aFileStream(aXmlFilePath, StreamMode::READ); CPPUNIT_ASSERT(aWalker.open(&aFileStream)); - CPPUNIT_ASSERT_EQUAL(OString("root"), aWalker.name()); - CPPUNIT_ASSERT_EQUAL(OString("Hello World"), aWalker.attribute("root-attr")); + CPPUNIT_ASSERT_EQUAL("root"_ostr, aWalker.name()); + CPPUNIT_ASSERT_EQUAL("Hello World"_ostr, aWalker.attribute("root-attr"_ostr)); int nNumberOfChildNodes = 0; @@ -54,21 +54,21 @@ void XmlWalkerTest::testReadXML() nNumberOfChildNodes++; CPPUNIT_ASSERT_EQUAL(OString(OString::number(nNumberOfChildNodes)), - aWalker.attribute("number")); + aWalker.attribute("number"_ostr)); if (nNumberOfChildNodes == 1) // only the first node has the attribute - CPPUNIT_ASSERT_EQUAL(OString("123"), aWalker.attribute("attribute")); + CPPUNIT_ASSERT_EQUAL("123"_ostr, aWalker.attribute("attribute"_ostr)); else - CPPUNIT_ASSERT_EQUAL(OString(), aWalker.attribute("attribute")); + CPPUNIT_ASSERT_EQUAL(OString(), aWalker.attribute("attribute"_ostr)); aWalker.children(); while (aWalker.isValid()) { if (aWalker.name() == "grandchild") { - CPPUNIT_ASSERT_EQUAL(OString("ABC"), aWalker.attribute("attribute1")); - CPPUNIT_ASSERT_EQUAL(OString("CDE"), aWalker.attribute("attribute2")); - CPPUNIT_ASSERT_EQUAL(OString("Content"), aWalker.content()); + CPPUNIT_ASSERT_EQUAL("ABC"_ostr, aWalker.attribute("attribute1"_ostr)); + CPPUNIT_ASSERT_EQUAL("CDE"_ostr, aWalker.attribute("attribute2"_ostr)); + CPPUNIT_ASSERT_EQUAL("Content"_ostr, aWalker.content()); } aWalker.next(); } @@ -76,8 +76,8 @@ void XmlWalkerTest::testReadXML() } else if (aWalker.name() == "with-namespace") { - CPPUNIT_ASSERT_EQUAL(OString("adobe:ns:meta/"), aWalker.namespaceHref()); - CPPUNIT_ASSERT_EQUAL(OString("xx"), aWalker.namespacePrefix()); + CPPUNIT_ASSERT_EQUAL("adobe:ns:meta/"_ostr, aWalker.namespaceHref()); + CPPUNIT_ASSERT_EQUAL("xx"_ostr, aWalker.namespacePrefix()); } aWalker.next(); } diff --git a/tools/qa/cppunit/test_xmlwriter.cxx b/tools/qa/cppunit/test_xmlwriter.cxx index 0fddb3d77de4..eeb475030f89 100644 --- a/tools/qa/cppunit/test_xmlwriter.cxx +++ b/tools/qa/cppunit/test_xmlwriter.cxx @@ -45,7 +45,7 @@ void XmlWriterTest::testSimpleRoot() aMemoryStream.Seek(0); OString aString(static_cast(aMemoryStream.GetData()), aMemoryStream.GetSize()); - CPPUNIT_ASSERT_EQUAL(OString(""), aString); + CPPUNIT_ASSERT_EQUAL(""_ostr, aString); } void XmlWriterTest::testSpecialChars() @@ -55,13 +55,13 @@ void XmlWriterTest::testSpecialChars() tools::XmlWriter aWriter(&aMemoryStream); aWriter.startDocument(0, false); aWriter.startElement("test"); - aWriter.content("<>"); + aWriter.content("<>"_ostr); aWriter.endElement(); aWriter.endDocument(); aMemoryStream.Seek(0); OString aString(static_cast(aMemoryStream.GetData()), aMemoryStream.GetSize()); - CPPUNIT_ASSERT_EQUAL(OString("<>"), aString); + CPPUNIT_ASSERT_EQUAL("<>"_ostr, aString); } CPPUNIT_TEST_SUITE_REGISTRATION(XmlWriterTest); diff --git a/tools/qa/cppunit/test_zcodec.cxx b/tools/qa/cppunit/test_zcodec.cxx index 69c4aeb2429c..935a234d4ff5 100644 --- a/tools/qa/cppunit/test_zcodec.cxx +++ b/tools/qa/cppunit/test_zcodec.cxx @@ -69,7 +69,7 @@ void ZCodecTest::testGzCompressDecompress() ZCodec aCodec; aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, true); // Set compression metadata for compressing a GZ file - aCodec.SetCompressionMetadata("dummy.txt", 0, nInitialStreamCRC32); + aCodec.SetCompressionMetadata("dummy.txt"_ostr, 0, nInitialStreamCRC32); aCodec.Compress(*pInitialStream, pCompressedStream); auto nCompressedSize = aCodec.EndCompression(); // returns compressed size or -1 if compression failed