diff options
author | scito <info@scito.ch> | 2021-06-13 14:32:53 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-14 11:25:01 +0200 |
commit | 213a6792990daab666856a532f8212b2601bd28a (patch) | |
tree | 617e9085744d1bc1066ca21d06902e0b0327fb45 /scripting | |
parent | 62503c3acde8eab0ca198f66519270761f64d56d (diff) |
ucalc_copypaste: improve readability and shorten
The tests are written in a simpler and shorter way. (The same, but 858 lines
less.) I've transformed the code with several regex in VSCode. I've
made a manual clean up at the end.
The regex are listed below in the form
***
search regex
replace regex
***
aString = m_pDoc->GetString\((\d+,\s*\d+,\s*\w+)\);
\s*CPPUNIT_ASSERT_EQUAL\(OUString\("(.*)"\), aString\);
CPPUNIT_ASSERT_EQUAL(OUString("$2"), m_pDoc->GetString($1));
***
m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\);
\s*CPPUNIT_ASSERT_EQUAL\(OUString\("(.*)"\), \w+\);
CPPUNIT_ASSERT_EQUAL(OUString("$2"), getFormula($1));
***
m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\);
\s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", OUString\("(.+)"\), \w+\);
CPPUNIT_ASSERT_EQUAL_MESSAGE("$2", OUString("$3"), getFormula($1));
***
ScAddress \w+\((\d+, \d+, \d+)\);(\s*//.+)?
\s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\);
\s*\w+->SetText\(\w+, "(.*)"\);
setNote($1, "$3");$2
***
ScAddress (\w+)\((\d+, \d+, \d+)\);(\s*//.+)?
\s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\);
\s*\w+->SetText\(\w+, "(.*)"\);
ScAddress $1 = setNote($2, "$4");$3
***
ScAddress (\w+)\((\d+, \d+, \w+)\);(\s*//.+)?
\s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\);
\s*\w+->SetText\(\w+, "(.*)"\);
setNote($2, "$4");$3
***
m_pDoc->GetNote\(ScAddress\((\d+, \d+, (\d+|\w+))\)\)
m_pDoc->GetNote($1)
***
"There should be(\s+\w+) note on (\w+)
"$2:$1 note
***
HasNote\(ScAddress\((\d+, \d+, (\d+|\w+))\)\)
HasNote($1)
***
ASSERT_DOUBLES_EQUAL\((-?\d+),
CPPUNIT_ASSERT_EQUAL($1.0,
***
\w+ = m_pDoc->GetString\((\d+, \d+, (\d+|\w+))\);
\s*CPPUNIT_ASSERT_EQUAL\(EMPTY_OUSTRING, \w+\);
CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString());
***
\w+ = m_pDoc->GetString\((\d+, \d+, (\d+|\w+))\);(\s*//.*)?
\s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", EMPTY_OUSTRING, \w+\);
CPPUNIT_ASSERT_EQUAL_MESSAGE("$4", EMPTY_OUSTRING, m_pDoc->GetString($2));$3
***
fValue = m_pDoc->GetValue\((\d+, \d+, (\d+|\w+))\);(\s*//.*)?
\s*ASSERT_DOUBLES_EQUAL_MESSAGE\("(.*)", (-?\d+), fValue\);
CPPUNIT_ASSERT_EQUAL_MESSAGE("$4", $5.0, m_pDoc->GetValue($1));
***
fValue = m_pDoc->GetValue\((\d+, \d+, (\d+|\w+))\);(\s*//.*)?
\s*CPPUNIT_ASSERT_EQUAL\((-?\d+(\.0)?), fValue\);
CPPUNIT_ASSERT_EQUAL($4, m_pDoc->GetValue($1));$3
***
m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\);(\s*//.*)?
\s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", OUString\("(.+)"\), \w+\);
CPPUNIT_ASSERT_EQUAL_MESSAGE("$3", OUString("$4"), getFormula($1));
***
aStr = m_pDoc->GetString\((\d+, \d+, \w+)\);(\s*//.*)?
\s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.*)", OUString\("(.*)"\), aStr\);
CPPUNIT_ASSERT_EQUAL_MESSAGE("$3", OUString("$4"), m_pDoc->GetString($1));
***
m_pDoc->GetNote\((\d+, \d+, (\d+|\w+))\)->GetText\(\)
getNote($1)
***
Change-Id: I4000b7f89a0bee1d2d52abfd6c1b055470e39d02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117085
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'scripting')
0 files changed, 0 insertions, 0 deletions