diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-03-31 16:39:45 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-04-03 11:41:00 +0000 |
commit | 0f62e829be66816831e1f04247dfb850912c3d50 (patch) | |
tree | 85d3f508689767f7e2f98370c17709e2a8ab3b9d /tests | |
parent | 967f2262591556bdc72bcbb3339754ca8dd96203 (diff) | |
download | qbs-0f62e829be66816831e1f04247dfb850912c3d50.tar.gz |
Handle digits in merged short options as option parameter
The argument list ["-a123b987"] becomes ["-a", "123", "-b", "987"].
Merged short options cannot be digits, e.g. ["-7j1"] is an error.
This way we can support the "-j8" option that everybody knows and loves
from make and other make'ish tools.
Task-number: QBS-196
Change-Id: I574d77e8f85a708708ebed43668bb3c6ca916233
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/cmdlineparser/tst_cmdlineparser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/cmdlineparser/tst_cmdlineparser.cpp b/tests/auto/cmdlineparser/tst_cmdlineparser.cpp index fcbb1bf14..92a202a45 100644 --- a/tests/auto/cmdlineparser/tst_cmdlineparser.cpp +++ b/tests/auto/cmdlineparser/tst_cmdlineparser.cpp @@ -140,6 +140,12 @@ private slots: QCOMPARE(parser.buildConfigurations().count(), 1); QCOMPARE(parser.buildConfigurations().first().value("qbs.configurationName").toString(), QLatin1String("debug")); QCOMPARE(parser.buildConfigurations().first().value("qbs.profile").toString(), QLatin1String("b")); + + // Digits are always handled as option parameters. + QVERIFY(parser.parseCommandLine(QStringList(fileArgs) << "-j" << "123")); + QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123); + QVERIFY(parser.parseCommandLine(QStringList(fileArgs) << "-j123")); + QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123); } void testInvalidCommandLine() @@ -156,6 +162,7 @@ private slots: QVERIFY(!parser.parseCommandLine(QStringList() << fileArgs << "--products")); // Missing argument. QVERIFY(!parser.parseCommandLine(QStringList() << "--changed-files" << "," << fileArgs)); // Wrong argument. QVERIFY(!parser.parseCommandLine(QStringList() << "--log-level" << "blubb" << fileArgs)); // Wrong argument. + QVERIFY(!parser.parseCommandLine(QStringList() << fileArgs << "-123")); // Unknown numeric argument. } void testProjectFileLookup() |