aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-10-30 09:29:31 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-10-30 15:04:49 +0000
commitc683b0274a026103f37ebb5bc57f12bb3f45cf36 (patch)
treed8e551aa75e303debbfcdac4a80e00a1c4751df2 /tests
parent9f44be09f72bee0f696ff37392afb420acf88564 (diff)
CLI: Add more test cases
Change-Id: I3024a3e826608ab1fa09bb288f524a3ef70329d1 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/cmdlineparser/tst_cmdlineparser.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/cmdlineparser/tst_cmdlineparser.cpp b/tests/auto/cmdlineparser/tst_cmdlineparser.cpp
index bdeb7c0bc..e8178800f 100644
--- a/tests/auto/cmdlineparser/tst_cmdlineparser.cpp
+++ b/tests/auto/cmdlineparser/tst_cmdlineparser.cpp
@@ -143,6 +143,22 @@ private slots:
QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123);
QVERIFY(parser.parseCommandLine(QStringList(fileArgs) << "-j123"));
QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123);
+
+ // Argument list separation for the "run" command.
+ QVERIFY(parser.parseCommandLine(QStringList("run") << fileArgs << "-j" << "123"
+ << "config:custom"));
+ QCOMPARE(parser.command(), RunCommandType);
+ QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123);
+ QCOMPARE(parser.buildConfigurations().first().value("qbs.configurationName").toString(),
+ QLatin1String("custom"));
+ QVERIFY(parser.runArgs().empty());
+ QVERIFY(parser.parseCommandLine(QStringList("run") << fileArgs << "-j" << "123" << "--"
+ << "config:custom"));
+ QCOMPARE(parser.command(), RunCommandType);
+ QCOMPARE(parser.buildOptions(QString()).maxJobCount(), 123);
+ QCOMPARE(parser.buildConfigurations().first().value("qbs.configurationName").toString(),
+ QLatin1String("default"));
+ QCOMPARE(parser.runArgs(), QStringList({"config:custom"}));
}
void testInvalidCommandLine()
@@ -161,6 +177,8 @@ private slots:
QVERIFY(!parser.parseCommandLine(QStringList() << "--log-level" << "blubb" << fileArgs)); // Wrong argument.
QVERIFY(!parser.parseCommandLine(QStringList() << fileArgs << "-123")); // Unknown numeric argument.
QVERIFY(!parser.parseCommandLine(QStringList() << fileArgs << "debug")); // Unknown parameter.
+ QVERIFY(!parser.parseCommandLine(QStringList("help") << "build" << "clean")); // Too many arguments.
+ QVERIFY(!parser.parseCommandLine(QStringList("clean") << "profile:x")); // This command cannot resolve.
}
};