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>
This commit is contained in:
parent
4209a47810
commit
8a9f358538
6 changed files with 15 additions and 31 deletions
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -666,11 +666,10 @@ namespace
|
|||
// first appearance to check
|
||||
{
|
||||
const OUString aUnoPackagReg(rUserConfigWorkURL + aRegPathFront + "bundle" + aRegPathBack);
|
||||
const OUString aTagToSearch("extension");
|
||||
|
||||
visitNodesXMLChangeOneCase(
|
||||
aUnoPackagReg,
|
||||
aTagToSearch,
|
||||
"extension",
|
||||
rToBeEnabled,
|
||||
rToBeDisabled);
|
||||
}
|
||||
|
@ -678,11 +677,10 @@ namespace
|
|||
// second appearance to check
|
||||
{
|
||||
const OUString aUnoPackagReg(rUserConfigWorkURL + aRegPathFront + "configuration" + aRegPathBack);
|
||||
const OUString aTagToSearch("configuration");
|
||||
|
||||
visitNodesXMLChangeOneCase(
|
||||
aUnoPackagReg,
|
||||
aTagToSearch,
|
||||
"configuration",
|
||||
rToBeEnabled,
|
||||
rToBeDisabled);
|
||||
}
|
||||
|
@ -690,11 +688,10 @@ namespace
|
|||
// third appearance to check
|
||||
{
|
||||
const OUString aUnoPackagReg(rUserConfigWorkURL + aRegPathFront + "script" + aRegPathBack);
|
||||
const OUString aTagToSearch("script");
|
||||
|
||||
visitNodesXMLChangeOneCase(
|
||||
aUnoPackagReg,
|
||||
aTagToSearch,
|
||||
"script",
|
||||
rToBeEnabled,
|
||||
rToBeDisabled);
|
||||
}
|
||||
|
|
|
@ -91,8 +91,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > ReadContentTypeSequence(
|
|||
const uno::Reference< io::XInputStream >& xInStream,
|
||||
const uno::Reference< uno::XComponentContext >& rContext )
|
||||
{
|
||||
OUString aStringID = "[Content_Types].xml";
|
||||
return ReadSequence_Impl( xInStream, aStringID, CONTENTTYPE_FORMAT, rContext );
|
||||
return ReadSequence_Impl( xInStream, "[Content_Types].xml", CONTENTTYPE_FORMAT, rContext );
|
||||
}
|
||||
|
||||
OUString GetContentTypeByName(
|
||||
|
|
Loading…
Reference in a new issue