diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-11-19 13:25:00 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-11-19 17:29:09 +0100 |
commit | db9104a366a57cc66f87467af8a329772d3f3b52 (patch) | |
tree | 86eef17344e36c52d4abfe67f6454c130a141508 /tools/qa/cppunit/test_config.cxx | |
parent | 156e7eafd76c819225a8bd77d0cf48fe19560c5f (diff) |
Extended loplugin:ostr: tools
Change-Id: I70df74d005c7fca14b1bcb70f4870023bd3af4a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159668
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools/qa/cppunit/test_config.cxx')
-rw-r--r-- | tools/qa/cppunit/test_config.cxx | 72 |
1 files changed, 36 insertions, 36 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("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()); |