summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/language/testdata/disabled-subproject.qbs28
-rw-r--r--tests/auto/language/tst_language.cpp17
-rw-r--r--tests/auto/language/tst_language.h1
3 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/language/testdata/disabled-subproject.qbs b/tests/auto/language/testdata/disabled-subproject.qbs
new file mode 100644
index 000000000..3074e5090
--- /dev/null
+++ b/tests/auto/language/testdata/disabled-subproject.qbs
@@ -0,0 +1,28 @@
+import qbs
+
+Project {
+ SubProject {
+ condition: false
+ filePath: "nosuchfile.qbs"
+ }
+ SubProject {
+ Properties {
+ condition: false
+ }
+ filePath: "nosuchfile.qbs"
+ }
+ SubProject {
+ condition: true
+ Properties {
+ condition: false
+ }
+ filePath: "nosuchfile.qbs"
+ }
+ SubProject {
+ condition: false
+ Properties {
+ condition: true
+ }
+ filePath: "nosuchfile.qbs"
+ }
+}
diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp
index 38bd86400..4153f1f69 100644
--- a/tests/auto/language/tst_language.cpp
+++ b/tests/auto/language/tst_language.cpp
@@ -553,6 +553,23 @@ void TestLanguage::derivedSubProject()
QCOMPARE(exceptionCaught, false);
}
+void TestLanguage::disabledSubProject()
+{
+ bool exceptionCaught = false;
+ try {
+ SetupProjectParameters params = defaultParameters;
+ params.setProjectFilePath(testProject("disabled-subproject.qbs"));
+ const TopLevelProjectPtr project = loader->loadProject(params);
+ QVERIFY(!!project);
+ const QHash<QString, ResolvedProductPtr> products = productsFromProject(project);
+ QCOMPARE(products.count(), 0);
+ } catch (const ErrorInfo &e) {
+ exceptionCaught = true;
+ qDebug() << e.toString();
+ }
+ QCOMPARE(exceptionCaught, false);
+}
+
void TestLanguage::enumerateProjectProperties()
{
bool exceptionCaught = false;
diff --git a/tests/auto/language/tst_language.h b/tests/auto/language/tst_language.h
index c7520e9dc..ee4888e11 100644
--- a/tests/auto/language/tst_language.h
+++ b/tests/auto/language/tst_language.h
@@ -90,6 +90,7 @@ private slots:
void delayedError_data();
void dependencyOnAllProfiles();
void derivedSubProject();
+ void disabledSubProject();
void enumerateProjectProperties();
void environmentVariable();
void errorInDisabledProduct();