diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-06-02 18:47:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-06-03 09:18:55 +0200 |
commit | 8a9f358538e4321c64923706afeb4c594debc3eb (patch) | |
tree | 8672b452bec988566b02c52466831bed17521ce8 /comphelper/qa | |
parent | 4209a4781071e778224c78fda498d09b3580448d (diff) |
Upcoming loplugin:elidestringvar: comphelper
Change-Id: Id388af90ca2c3dff435a1a6261e3de0c3c0dbdbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95376
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper/qa')
-rw-r--r-- | comphelper/qa/string/test_string.cxx | 3 | ||||
-rw-r--r-- | comphelper/qa/unit/syntaxhighlighttest.cxx | 15 | ||||
-rw-r--r-- | comphelper/qa/unit/test_hash.cxx | 10 | ||||
-rw-r--r-- | comphelper/qa/unit/variadictemplates.cxx | 6 |
4 files changed, 11 insertions, 23 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index 14bc3f7cebd3..abccec85691c 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -378,8 +378,7 @@ void TestString::testReverseString() void TestString::testSplit() { - OUString aIn("CTRL+ALT+F1"); - std::vector<OUString> aRet = ::comphelper::string::split(aIn, '+'); + std::vector<OUString> aRet = ::comphelper::string::split("CTRL+ALT+F1", '+'); CPPUNIT_ASSERT_EQUAL(size_t(3), aRet.size()); CPPUNIT_ASSERT_EQUAL(OUString("CTRL"), aRet[0]); CPPUNIT_ASSERT_EQUAL(OUString("ALT"), aRet[1]); diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx index 8a5b66ed2d08..c28941339085 100644 --- a/comphelper/qa/unit/syntaxhighlighttest.cxx +++ b/comphelper/qa/unit/syntaxhighlighttest.cxx @@ -37,9 +37,8 @@ public: }; void SyntaxHighlightTest::testBasicString() { - OUString s("\"foo\""); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("\"foo\"", ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -48,9 +47,8 @@ void SyntaxHighlightTest::testBasicString() { } void SyntaxHighlightTest::testBasicComment() { - OUString s("' foo"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("' foo", ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -59,9 +57,8 @@ void SyntaxHighlightTest::testBasicComment() { } void SyntaxHighlightTest::testBasicCommentNewline() { - OUString s("' foo\n"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("' foo\n", ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -73,9 +70,8 @@ void SyntaxHighlightTest::testBasicCommentNewline() { } void SyntaxHighlightTest::testBasicEmptyComment() { - OUString s("'"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("'", ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); @@ -84,9 +80,8 @@ void SyntaxHighlightTest::testBasicEmptyComment() { } void SyntaxHighlightTest::testBasicEmptyCommentNewline() { - OUString s("'\n"); std::vector<HighlightPortion> ps; - SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions(s, ps); + SyntaxHighlighter(HighlighterLanguage::Basic).getHighlightPortions("'\n", ps); CPPUNIT_ASSERT_EQUAL( static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size()); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ps[0].nBegin); diff --git a/comphelper/qa/unit/test_hash.cxx b/comphelper/qa/unit/test_hash.cxx index 99ce5bfd1751..8b6e5a393d23 100644 --- a/comphelper/qa/unit/test_hash.cxx +++ b/comphelper/qa/unit/test_hash.cxx @@ -120,13 +120,9 @@ void TestHash::testSHA512_NoSaltNoSpin() // tdf#104250 https://bugs.documentfoundation.org/attachment.cgi?id=129104 void TestHash::testSHA512_saltspin() { - const OUString aPass("pwd"); - const OUString aAlgo("SHA-512"); - const OUString aSalt("876MLoKTq42+/DLp415iZQ=="); - const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( aPass, aSalt, 100000, - comphelper::Hash::IterCount::APPEND, aAlgo); - const OUString aStr("5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g=="); - CPPUNIT_ASSERT_EQUAL(aStr, aHash); + const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( "pwd", "876MLoKTq42+/DLp415iZQ==", 100000, + comphelper::Hash::IterCount::APPEND, "SHA-512"); + CPPUNIT_ASSERT_EQUAL(OUString("5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g=="), aHash); } CPPUNIT_TEST_SUITE_REGISTRATION(TestHash); diff --git a/comphelper/qa/unit/variadictemplates.cxx b/comphelper/qa/unit/variadictemplates.cxx index c894cf1a7bb6..e729d76b24ed 100644 --- a/comphelper/qa/unit/variadictemplates.cxx +++ b/comphelper/qa/unit/variadictemplates.cxx @@ -90,8 +90,6 @@ void VariadicTemplatesTest::testUnwrapArgs() { OUString tmp1 = "Test1"; sal_Int32 tmp2 = 42; sal_uInt32 tmp3 = 42; - OUString tmp4 = "Test2"; - OUString tmp5 = "Test3"; ::com::sun::star::uno::Any tmp6( ::com::sun::star::uno::makeAny( tmp1 ) ); @@ -102,10 +100,10 @@ void VariadicTemplatesTest::testUnwrapArgs() { ::com::sun::star::uno::makeAny( tmp3 ) ); ::com::sun::star::uno::Any tmp9( - ::com::sun::star::uno::makeAny( tmp4 ) + ::com::sun::star::uno::makeAny( OUString("Test2") ) ); ::std::optional< ::com::sun::star::uno::Any > tmp10( - ::com::sun::star::uno::makeAny( tmp5 ) + ::com::sun::star::uno::makeAny( OUString("Test3") ) ); ::std::optional< ::com::sun::star::uno::Any > tmp11( ::com::sun::star::uno::makeAny( tmp1 ) |