forked from qt-creator/qt-creator
Tests: Fix ChangeSet test - now use start,end instead of start,length.
The ChangeSet api was changed in
eb749ec3a2
This commit is contained in:
@@ -60,14 +60,14 @@ void tst_ChangeSet::singleReplace()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.replace(4, 2, "ghi"));
|
||||
QVERIFY(cs.replace(4, 6, "ghi"));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdghi"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.replace(3, 0, "ghi"));
|
||||
QVERIFY(cs.replace(3, 3, "ghi"));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcghidef"));
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void tst_ChangeSet::singleReplace()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.replace(3, 10, "ghi"));
|
||||
QVERIFY(cs.replace(3, 13, "ghi"));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcghi"));
|
||||
}
|
||||
@@ -99,21 +99,21 @@ void tst_ChangeSet::singleMove()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.move(4, 2, 0));
|
||||
QVERIFY(cs.move(4, 6, 0));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("efabcd"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.move(3, 10, 0));
|
||||
QVERIFY(cs.move(3, 13, 0));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("defabc"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.move(3, 0, 0));
|
||||
QVERIFY(cs.move(3, 3, 0));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
}
|
||||
@@ -172,28 +172,28 @@ void tst_ChangeSet::singleRemove()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.remove(3, 3));
|
||||
QVERIFY(cs.remove(3, 6));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abc"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.remove(4, 10));
|
||||
QVERIFY(cs.remove(4, 14));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcd"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.remove(2, 0));
|
||||
QVERIFY(cs.remove(2, 2));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.remove(7, 1));
|
||||
QVERIFY(cs.remove(7, 8));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
}
|
||||
@@ -204,53 +204,53 @@ void tst_ChangeSet::singleFlip()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.flip(0, 2, 3, 3));
|
||||
QVERIFY(cs.flip(0, 2, 3, 6));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("defcab"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.flip(1, 2, 3, 1));
|
||||
QVERIFY(cs.flip(1, 3, 3, 4));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("adbcef"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.flip(3, 0, 4, 0));
|
||||
QVERIFY(cs.flip(3, 3, 4, 4));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.flip(3, 0, 4, 1));
|
||||
QVERIFY(cs.flip(3, 3, 4, 5));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcedf"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.flip(0, 6, 6, 6));
|
||||
QVERIFY(cs.flip(0, 6, 6, 12));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.flip(0, 6, 7, 3));
|
||||
QVERIFY(cs.flip(0, 6, 7, 10));
|
||||
cs.apply(&test);
|
||||
// ### maybe this should expand the string or error?
|
||||
QCOMPARE(test, QLatin1String(""));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QCOMPARE(cs.flip(0, 3, 1, 3), false);
|
||||
QCOMPARE(cs.flip(0, 3, 1, 4), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QCOMPARE(cs.flip(0, 3, 2, 3), false);
|
||||
QCOMPARE(cs.flip(0, 3, 2, 5), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
@@ -268,7 +268,7 @@ void tst_ChangeSet::singleFlip()
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.flip(0, 3, 3, 0));
|
||||
QVERIFY(cs.flip(0, 3, 3, 3));
|
||||
QString test("abcdef");
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
@@ -287,14 +287,14 @@ void tst_ChangeSet::singleCopy()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.copy(1, 2, 3));
|
||||
QVERIFY(cs.copy(1, 3, 3));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcbcdef"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QString test("abcdef");
|
||||
QVERIFY(cs.copy(3, 0, 4));
|
||||
QVERIFY(cs.copy(3, 3, 4));
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("abcdef"));
|
||||
}
|
||||
@@ -358,7 +358,7 @@ void tst_ChangeSet::doubleInsert()
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.insert(1, "01"));
|
||||
QVERIFY(cs.remove(1, 1));
|
||||
QVERIFY(cs.remove(1, 2));
|
||||
QVERIFY(cs.insert(2, "234"));
|
||||
QString test("abcdef");
|
||||
cs.apply(&test);
|
||||
@@ -370,48 +370,48 @@ void tst_ChangeSet::conflicts()
|
||||
{
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(0, 2, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(1, 3, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(1, 4, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(1, 1, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(1, 2, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(2, 0, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(2, 2, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(2, 1, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(2, 3, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(3, 0, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(3, 3, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(3, 1, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(3, 4, "abc"), false);
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QCOMPARE(cs.replace(4, 2, "abc"), false);
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QCOMPARE(cs.replace(4, 6, "abc"), false);
|
||||
}
|
||||
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QVERIFY(cs.replace(0, 1, "bla"));
|
||||
QString test("abcdef");
|
||||
cs.apply(&test);
|
||||
@@ -419,16 +419,16 @@ void tst_ChangeSet::conflicts()
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QVERIFY(cs.replace(4, 1, "bla"));
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QVERIFY(cs.replace(4, 5, "bla"));
|
||||
QString test("abcdef");
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("ablabcdf"));
|
||||
}
|
||||
{
|
||||
Utils::ChangeSet cs;
|
||||
QVERIFY(cs.move(1, 3, 5));
|
||||
QVERIFY(cs.replace(5, 1, "bla"));
|
||||
QVERIFY(cs.move(1, 4, 5));
|
||||
QVERIFY(cs.replace(5, 6, "bla"));
|
||||
QString test("abcdef");
|
||||
cs.apply(&test);
|
||||
QCOMPARE(test, QLatin1String("aebcdbla"));
|
||||
|
||||
Reference in New Issue
Block a user