summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Zander <t.zander@nokia.com>2010-02-17 12:02:37 (GMT)
committerThomas Zander <t.zander@nokia.com>2010-02-17 12:29:33 (GMT)
commit505dc33a4060b6fb2a80f3a3ab2a6702ec0b5f3b (patch)
treea9d722b9d598b7f34c98d68d7035bfa3f3f39696
parentfd3f9dd0f31efeea3aa0ec28b54c70d85712c7ba (diff)
downloadQt-505dc33a4060b6fb2a80f3a3ab2a6702ec0b5f3b.zip
Qt-505dc33a4060b6fb2a80f3a3ab2a6702ec0b5f3b.tar.gz
Qt-505dc33a4060b6fb2a80f3a3ab2a6702ec0b5f3b.tar.bz2
Make the licenseheader check pass trivial files.
A file that contains so little doesn't have to have the copyright header. A good example usecase is a header file with nothing but an include line to another header. Reviewed-by: Thiago Macieira
-rw-r--r--tests/auto/headers/tst_headers.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 5f79923..bf7ec3f 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -192,19 +192,20 @@ void tst_Headers::licenseCheck()
QByteArray data = f.readAll();
data.replace("\r\n", "\n"); // Windows
data.replace('\r', '\n'); // Mac OS9
- QStringList content = QString::fromLocal8Bit(data).split("\n");
+ QStringList content = QString::fromLocal8Bit(data).split("\n", QString::SkipEmptyParts);
+
+ if (content.count() <= 2) // likely a #include line and empty line only. Not a copyright issue.
+ return;
if (content.first().contains("generated")) {
content.takeFirst();
- if (content.first().isEmpty())
- content.takeFirst();
}
if (sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/merge_ordering/foo.cpp")
|| sourceFile.endsWith("/tests/auto/linguist/lupdate/testdata/good/mergecpp/finddialog.cpp"))
{
// These files are meant to start with empty lines.
- while (content.first().isEmpty() || content.first().startsWith("//"))
+ while (content.first().startsWith("//"))
content.takeFirst();
}