From be2c54531eeb00822259d6f6bfcb90b43768cea3 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Thu, 15 Apr 2021 15:52:33 +0300 Subject: Add possibility to list components with regexp Task-number: QTIFW-2225 Change-Id: I6a7fdfc1070ad54d520563cae7d2446e97e2e87c Reviewed-by: Arttu Tarkiainen --- tests/auto/installer/scriptengine/tst_scriptengine.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp index b7c602e26..105bcf5d7 100644 --- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp +++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp @@ -349,6 +349,21 @@ private slots: } } + void testComponentsWithRegexp() + { + const QString script = QString::fromLatin1("var components = installer.components(\"component.test.addOperation\");" + "\n" + "for (i = 0; i < components.length; i++)" + "print(components[i].name);"); + + setExpectedScriptOutput("component.test.addOperation"); + const QJSValue value = m_scriptEngine->evaluate(script); + if (value.isError()) { + QFAIL(qPrintable(QString::fromLatin1("ScriptEngine error:\n %1").arg( + value.toString()))); + } + } + void testFindFiles() { const QString expectedOutput = QString::fromLatin1("Found file %1/tst_scriptengine.moc").arg(m_applicatonDirPath); -- cgit v1.2.3