diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-08-06 08:38:07 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-08-06 08:40:32 (GMT) |
commit | 2be8aa471585d7aff5701c945c83f855ca3bfd59 (patch) | |
tree | 857522f0c0e784ef25509f63df635534ec29e0df | |
parent | d16ae8ffa8432541ddf481d4166a04e9cfa4e5b4 (diff) | |
download | Qt-2be8aa471585d7aff5701c945c83f855ca3bfd59.zip Qt-2be8aa471585d7aff5701c945c83f855ca3bfd59.tar.gz Qt-2be8aa471585d7aff5701c945c83f855ca3bfd59.tar.bz2 |
Normalize line endings before comparing the lines.
We already trimmed away any \r from the expected line, but we did not
trim away \r from the actual line. That caused some false negatives on
windows.
-rw-r--r-- | tests/auto/linguist/lupdate/tst_lupdate.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index fcf8582..97400d9 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -93,13 +93,24 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn } else if (i == ei) { ei = 0; break; - } else if (err ? !QRegExp(expected.at(i)).exactMatch(actual.at(i)) : - (actual.at(i) != expected.at(i))) { - while ((ei - 1) >= i && (gi - 1) >= i && - (err ? QRegExp(expected.at(ei - 1)).exactMatch(actual.at(gi - 1)) : - (actual.at(gi - 1) == expected.at(ei - 1)))) - ei--, gi--; - break; + } else { + QString act = actual.at(i); + act.remove('\r'); + if (err ? !QRegExp(expected.at(i)).exactMatch(act) : + (act != expected.at(i))) { + bool cond = true; + while (cond) { + act = actual.at(gi - 1); + act.remove('\r'); + cond = (ei - 1) >= i && (gi - 1) >= i && + (err ? QRegExp(expected.at(ei - 1)).exactMatch(act) : + (act == expected.at(ei - 1))); + if (cond) { + ei--, gi--; + } + } + break; + } } } QByteArray diff; |