summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 5154351bb1..4a423b036c 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -622,6 +622,8 @@ private slots:
void unnamedNamespaceObjectsAndGadgets();
void veryLongStringData();
void gadgetHierarchy();
+ void optionsFileError_data();
+ void optionsFileError();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -3497,6 +3499,31 @@ void tst_Moc::gadgetHierarchy()
QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject);
}
+void tst_Moc::optionsFileError_data()
+{
+ QTest::addColumn<QString>("optionsArgument");
+ QTest::newRow("no filename") << QStringLiteral("@");
+ QTest::newRow("nonexistent file") << QStringLiteral("@letshuntasnark");
+}
+
+void tst_Moc::optionsFileError()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled");
+#endif
+#if !defined(QT_NO_PROCESS)
+ QFETCH(QString, optionsArgument);
+ QProcess p;
+ p.start(m_moc, QStringList(optionsArgument));
+ QVERIFY(p.waitForFinished());
+ QCOMPARE(p.exitCode(), 1);
+ QVERIFY(p.readAllStandardOutput().isEmpty());
+ const QByteArray err = p.readAllStandardError();
+ QVERIFY(err.contains("moc: "));
+ QVERIFY(!err.contains("QCommandLineParser"));
+#endif
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS