diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-04-28 10:27:55 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-04-28 10:27:55 (GMT) |
commit | 4d520cd01007f0133ca197c07d9d8eb0ad2c5d82 (patch) | |
tree | 24fd0ef4d1da410f593625e68e2a2c9abd8a0302 | |
parent | 1e4912c70ee2ce8ce7e62bc1daad625070bc4a44 (diff) | |
download | Qt-4d520cd01007f0133ca197c07d9d8eb0ad2c5d82.zip Qt-4d520cd01007f0133ca197c07d9d8eb0ad2c5d82.tar.gz Qt-4d520cd01007f0133ca197c07d9d8eb0ad2c5d82.tar.bz2 |
tst_selftests: replace a line number with __LINE__ in XML too
-rw-r--r-- | tests/auto/selftests/tst_selftests.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 0ef000c..b824fd3 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -117,19 +117,26 @@ static QList<QByteArray> splitLines(QByteArray ba) ba.replace('\r', ""); QList<QByteArray> out = ba.split('\n'); - // Replace any ` file="..."' in XML with a generic location. - static const char marker[] = " file=\""; + // Replace any ` file="..."' or ` line="..."' in XML with a generic location. + static const char *markers[][2] = { + { " file=\"", " file=\"__FILE__\"" }, + { " line=\"", " line=\"__LINE__\"" } + }; + static const int markerCount = sizeof markers / sizeof markers[0]; + for (int i = 0; i < out.size(); ++i) { QByteArray& line = out[i]; - int index = line.indexOf(marker); - if (index == -1) { - continue; - } - int end = line.indexOf('"', index + sizeof(marker)); - if (end == -1) { - continue; + for (int j = 0; j < markerCount; ++j) { + int index = line.indexOf(markers[j][0]); + if (index == -1) { + continue; + } + int end = line.indexOf('"', index + strlen(markers[j][0]) + 1); + if (end == -1) { + continue; + } + line.replace(index, end-index, markers[j][1]); } - line.replace(index, end-index, " file=\"__FILE__\""); } return out; |