From 505dc33a4060b6fb2a80f3a3ab2a6702ec0b5f3b Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 17 Feb 2010 13:02:37 +0100 Subject: 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 --- tests/auto/headers/tst_headers.cpp | 9 +++++---- 1 file 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(); } -- cgit v0.12