From 59f0381185e1c5f5089786d52fccb4cfa33a4a24 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 13 Sep 2022 08:38:53 +0200 Subject: [PATCH] tst_linebylinelex: Hotfix: skip test if no test data is found The test looks in the wrong place for the test data. As a hot-fix, skip the test if no test-data is found to avoid a subsequent assert. Task-number: QTBUG-105697 Change-Id: Ib7a38faec123662fb1ea9fad8d0da60ede074486 Reviewed-by: Ulf Hermann --- tests/auto/qml/linebylinelex/tst_linebylinelex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/qml/linebylinelex/tst_linebylinelex.cpp b/tests/auto/qml/linebylinelex/tst_linebylinelex.cpp index 64dcc9a4ed..02ce1f33f3 100644 --- a/tests/auto/qml/linebylinelex/tst_linebylinelex.cpp +++ b/tests/auto/qml/linebylinelex/tst_linebylinelex.cpp @@ -67,10 +67,14 @@ void TestLineByLineLex::testFormatter_data() { QTest::addColumn("filename"); QDir formatData(m_baseDir + u"/qmlformat/data"_s); + bool hasTestData = false; // ### TODO: fix test to always have data for (const QFileInfo &fInfo : formatData.entryInfoList(QStringList({ u"*.qml"_s, u"*.js"_s }), QDir::Files)) { QTest::newRow(qPrintable(fInfo.fileName())) << fInfo.absoluteFilePath(); + hasTestData = true; } + if (!hasTestData) + QSKIP("No test data found!"); } void TestLineByLineLex::testFormatter()