diff options
| author | Christian Kandeler <christian.kandeler@digia.com> | 2013-10-28 10:06:18 +0100 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-10-28 11:52:38 +0100 |
| commit | fa69cddcdfbdda334ebde569b8cd9a1f0390fec1 (patch) | |
| tree | 388aac837168ca81a76b7354954e6c6f4bc1286c /tests | |
| parent | 08a5cafa374420456e599d7eab619c4f7667cd97 (diff) | |
| download | qbs-fa69cddcdfbdda334ebde569b8cd9a1f0390fec1.tar.gz | |
Check for duplicate product names.
Strangely, no such check exists currently. Instead, one will typically
get an internal error on the artifact level later on.
Change-Id: Id9cd749a70564100bd7286b896f64cafbe9bfb73
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests')
7 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/duplicateProductNames/explicit.qbs b/tests/auto/blackbox/testdata/duplicateProductNames/explicit.qbs new file mode 100644 index 000000000..0183b411c --- /dev/null +++ b/tests/auto/blackbox/testdata/duplicateProductNames/explicit.qbs @@ -0,0 +1,7 @@ +import qbs + +Project { + Product { name: "blubb" } + Product { name: "blubb" } + Product { name: "blubb" } +} diff --git a/tests/auto/blackbox/testdata/duplicateProductNames/implicit-indirect.qbs b/tests/auto/blackbox/testdata/duplicateProductNames/implicit-indirect.qbs new file mode 100644 index 000000000..7164aa1c5 --- /dev/null +++ b/tests/auto/blackbox/testdata/duplicateProductNames/implicit-indirect.qbs @@ -0,0 +1,5 @@ +import qbs + +Project { + references: ["subdir1/subproject.qbs", "subdir2/subproject.qbs"] +} diff --git a/tests/auto/blackbox/testdata/duplicateProductNames/implicit.qbs b/tests/auto/blackbox/testdata/duplicateProductNames/implicit.qbs new file mode 100644 index 000000000..f39f80626 --- /dev/null +++ b/tests/auto/blackbox/testdata/duplicateProductNames/implicit.qbs @@ -0,0 +1,7 @@ +import qbs + +Project { + Product { } + Product { } + Product { } +} diff --git a/tests/auto/blackbox/testdata/duplicateProductNames/subdir1/subproject.qbs b/tests/auto/blackbox/testdata/duplicateProductNames/subdir1/subproject.qbs new file mode 100644 index 000000000..6d16a3c53 --- /dev/null +++ b/tests/auto/blackbox/testdata/duplicateProductNames/subdir1/subproject.qbs @@ -0,0 +1,3 @@ +import qbs + +Product { } diff --git a/tests/auto/blackbox/testdata/duplicateProductNames/subdir2/subproject.qbs b/tests/auto/blackbox/testdata/duplicateProductNames/subdir2/subproject.qbs new file mode 100644 index 000000000..6d16a3c53 --- /dev/null +++ b/tests/auto/blackbox/testdata/duplicateProductNames/subdir2/subproject.qbs @@ -0,0 +1,3 @@ +import qbs + +Product { } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 8cbbbb50a..ddebcce0e 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -1188,6 +1188,25 @@ void TestBlackbox::disabledProject() QCOMPARE(runQbs(), 0); } +void TestBlackbox::duplicateProductNames() +{ + QDir::setCurrent(testDataDir + "/duplicateProductNames"); + QFETCH(QString, projectFileName); + QbsRunParameters params; + params.expectFailure = true; + params.arguments = QStringList() << "-f" << projectFileName; + QVERIFY(runQbs(params) != 0); + QVERIFY(m_qbsStderr.contains("Duplicate product name")); +} + +void TestBlackbox::duplicateProductNames_data() +{ + QTest::addColumn<QString>("projectFileName"); + QTest::newRow("Names explicitly set") << QString("explicit.qbs"); + QTest::newRow("Unnamed products in same file") << QString("implicit.qbs"); + QTest::newRow("Unnamed products in files of the same name") << QString("implicit-indirect.qbs"); +} + void TestBlackbox::dynamicLibs() { QDir::setCurrent(testDataDir + "/dynamicLibs"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index c9a5d975b..042446a96 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -101,6 +101,8 @@ private slots: void dependenciesProperty(); void disabledProduct(); void disabledProject(); + void duplicateProductNames(); + void duplicateProductNames_data(); void dynamicLibs(); void explicitlyDependsOn(); void fileDependencies(); |
