tools/qa/cppunit/test_config.cxx      |   72 ++++++++++++------------
 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 
 xmlscript/qa/cppunit/test.cxx         |  100 +++++++++++++++++++---------------
 9 files changed, 139 insertions(+), 123 deletions(-)

New commits:
commit db9104a366a57cc66f87467af8a329772d3f3b52
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Sun Nov 19 13:25:00 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Sun Nov 19 17:29:09 2023 +0100

    Extended loplugin:ostr: tools
    
    Change-Id: I70df74d005c7fca14b1bcb70f4870023bd3af4a1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159668
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

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("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("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"_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<const char*>(aMemoryStream.GetData()), 
aMemoryStream.GetSize());
-    CPPUNIT_ASSERT_EQUAL(OString("<test/>"), aString);
+    CPPUNIT_ASSERT_EQUAL("<test/>"_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<const char*>(aMemoryStream.GetData()), 
aMemoryStream.GetSize());
-    CPPUNIT_ASSERT_EQUAL(OString("<test>&lt;&gt;</test>"), aString);
+    CPPUNIT_ASSERT_EQUAL("<test>&lt;&gt;</test>"_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
commit 156e7eafd76c819225a8bd77d0cf48fe19560c5f
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Sun Nov 19 13:21:26 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Sun Nov 19 17:28:56 2023 +0100

    Extended loplugin:ostr: xmlscript
    
    Change-Id: I1b476b6fb89ee04b4427ba1210eee9811a722f0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159661
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/xmlscript/qa/cppunit/test.cxx b/xmlscript/qa/cppunit/test.cxx
index 92c543e36f6d..f29c9bb7ba59 100644
--- a/xmlscript/qa/cppunit/test.cxx
+++ b/xmlscript/qa/cppunit/test.cxx
@@ -147,42 +147,55 @@ void XmlScriptTest::testBasicElements()
     CPPUNIT_ASSERT(pXmlDoc);
 
     // Ensure we have all elements
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:button[1]", "id", 
"button1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:button[2]", "id", 
"button3");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[1]", 
"id", "check1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[2]", 
"id", "check2");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[3]", 
"id", "check3");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:menulist[1]", 
"id", "list1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:menulist[2]", 
"id", "list2");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:combobox[1]", 
"id", "combo1");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[1]", "id",
-                "radio1");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[2]", "id",
-                "radio2");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[3]", "id",
-                "radio3");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:titledbox[1]", 
"id", "groupbox1");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[1]", "id",
-                "radio5");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[2]", "id",
-                "radio7");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[3]", "id",
-                "radio8");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:text[1]", "id", 
"fixed1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:textfield[1]", 
"id", "field1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:textfield[2]", 
"id", "field2");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:img[1]", "id", 
"image1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:filecontrol[1]", 
"id", "file1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:datefield[1]", 
"id", "datefield1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:timefield[1]", 
"id", "time1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:patternfield[1]", 
"id", "pattern1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:currencyfield[1]", 
"id", "currency1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:numericfield[1]", 
"id", "numeric1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:fixedline[1]", 
"id", "fixedline1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:progressmeter[1]", 
"id", "progress1");
-    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:scrollbar[1]", 
"id", "scrollbar1");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:formattedfield[1]", "id", "ffield0");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:formattedfield[2]", "id", "ffield1");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:button[1]"_ostr, 
"id"_ostr, "button1");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:button[2]"_ostr, 
"id"_ostr, "button3");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[1]"_ostr, 
"id"_ostr, "check1");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[2]"_ostr, 
"id"_ostr, "check2");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[3]"_ostr, 
"id"_ostr, "check3");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:menulist[1]"_ostr, 
"id"_ostr, "list1");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:menulist[2]"_ostr, 
"id"_ostr, "list2");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:combobox[1]"_ostr, 
"id"_ostr, "combo1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[1]"_ostr,
+                "id"_ostr, "radio1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[2]"_ostr,
+                "id"_ostr, "radio2");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[3]"_ostr,
+                "id"_ostr, "radio3");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:titledbox[1]"_ostr, "id"_ostr,
+                "groupbox1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[1]"_ostr,
+                "id"_ostr, "radio5");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[2]"_ostr,
+                "id"_ostr, "radio7");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[3]"_ostr,
+                "id"_ostr, "radio8");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:text[1]"_ostr, 
"id"_ostr, "fixed1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:textfield[1]"_ostr, "id"_ostr,
+                "field1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:textfield[2]"_ostr, "id"_ostr,
+                "field2");
+    assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:img[1]"_ostr, 
"id"_ostr, "image1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:filecontrol[1]"_ostr, "id"_ostr,
+                "file1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:datefield[1]"_ostr, "id"_ostr,
+                "datefield1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:timefield[1]"_ostr, "id"_ostr, "time1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:patternfield[1]"_ostr, "id"_ostr,
+                "pattern1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:currencyfield[1]"_ostr, "id"_ostr,
+                "currency1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:numericfield[1]"_ostr, "id"_ostr,
+                "numeric1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:fixedline[1]"_ostr, "id"_ostr,
+                "fixedline1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:progressmeter[1]"_ostr, "id"_ostr,
+                "progress1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:scrollbar[1]"_ostr, "id"_ostr,
+                "scrollbar1");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:formattedfield[1]"_ostr, "id"_ostr,
+                "ffield0");
+    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:formattedfield[2]"_ostr, "id"_ostr,
+                "ffield1");
 
     Reference<lang::XComponent> xDialogModelComp(xModel, UNO_QUERY);
     if (xDialogModelComp)
@@ -205,12 +218,15 @@ void XmlScriptTest::testEmptyPopupItems()
     CPPUNIT_ASSERT(pXmlDoc);
 
     // Ensure we have 3 items in combobox after import/export and second one 
is empty
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[1]",
-                "value", "Eintrag1");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[2]",
-                "value", "");
-    assertXPath(pXmlDoc, 
"/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[3]",
-                "value", "Eintrag2");
+    assertXPath(pXmlDoc,
+                
"/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[1]"_ostr,
+                "value"_ostr, "Eintrag1");
+    assertXPath(pXmlDoc,
+                
"/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[2]"_ostr,
+                "value"_ostr, "");
+    assertXPath(pXmlDoc,
+                
"/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[3]"_ostr,
+                "value"_ostr, "Eintrag2");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(XmlScriptTest);

Reply via email to