summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2016-09-17 12:10:36 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2017-02-10 06:55:48 +0000
commit0e20635c39417ebf79f43a9890d777a52caf9922 (patch)
treee25d1b96180b4e80193f28e4d15e840c9ba254f6 /tests
parent8a410f60ae39b06555d807581caf7cb8bfab4fac (diff)
moc: error out when the Q_PLUGIN_METADATA file can't be opened
Task-number: QTBUG-56045 Change-Id: Ib058791036a2728dcd6215009a4ff206278bed14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index ecf6c7e992..e704a6877e 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -2145,6 +2145,22 @@ void tst_Moc::warnings_data()
<< 0
<< QString()
<< QString("standard input:1: Note: No relevant classes found. No output generated.");
+
+ QTest::newRow("Q_PLUGIN_METADATA: invalid file")
+ << QByteArray("class X { \n Q_PLUGIN_METADATA(FILE \"does.not.exists\") \n };")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:2: Error: Plugin Metadata file \"does.not.exists\" does not exist. Declaration will be ignored");
+
+#ifdef Q_OS_LINUX // Limit to Linux because the error message is platform-dependent
+ QTest::newRow("Q_PLUGIN_METADATA: unreadable file")
+ << QByteArray("class X { \n Q_PLUGIN_METADATA(FILE \".\") \n };")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:2: Error: Plugin Metadata file \".\" could not be opened: file to open is a directory");
+#endif
}
void tst_Moc::warnings()