forked from qt-creator/qt-creator
CppEditor: Tests: Call QByteArray::remove() only with i >= 0
For example test_quickfix_InsertDefFromDecl_afterClass led to a QByteArray::remove(-1) call. According to the doc nothing happens, but it will become problematic later when we change to QString (with that, a character will be removed from the end). Change-Id: Ie89dd7834e44fbcfde63ea6ca3ab181dfe50e191 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -79,8 +79,12 @@ QuickFixTestDocument::QuickFixTestDocument(const QByteArray &fileName,
|
||||
: TestDocument(fileName, source)
|
||||
, m_expectedSource(expectedSource)
|
||||
{
|
||||
m_source.remove(m_cursorPosition, 1);
|
||||
m_expectedSource.remove(expectedSource.indexOf(m_cursorMarker), 1);
|
||||
if (m_cursorPosition > -1)
|
||||
m_source.remove(m_cursorPosition, 1);
|
||||
|
||||
const int cursorPositionInExpectedSource = m_expectedSource.indexOf(m_cursorMarker);
|
||||
if (cursorPositionInExpectedSource > -1)
|
||||
m_expectedSource.remove(cursorPositionInExpectedSource, 1);
|
||||
}
|
||||
|
||||
QList<QuickFixTestDocument::Ptr> singleDocument(const QByteArray &original,
|
||||
|
||||
Reference in New Issue
Block a user