aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-05-16 09:55:16 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-05-16 12:43:11 +0000
commit34f4ec11bd2cf430146340b8a2d4a3db6abe4866 (patch)
tree6f247bc3a7dbf3628d96f1ef8ea9093bd6010755
parent7e4c7aa77961dbdde132a76848ff5a6680a0c1a8 (diff)
CommandLine: Add a constructor test
Change-Id: I5d5bf8e7f31017f16663103f560e598e2a003d50 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--tests/auto/utils/commandline/tst_commandline.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/utils/commandline/tst_commandline.cpp b/tests/auto/utils/commandline/tst_commandline.cpp
index d884e47c8d..aca984adf5 100644
--- a/tests/auto/utils/commandline/tst_commandline.cpp
+++ b/tests/auto/utils/commandline/tst_commandline.cpp
@@ -125,6 +125,31 @@ private slots:
QCOMPARE(actual, expected);
}
+ void testConstructor_data()
+ {
+ QTest::addColumn<CommandLine>("command");
+ QTest::addColumn<FilePath>("executable");
+ QTest::addColumn<QStringList>("arguments");
+
+ const FilePath filePath("some_path");
+ const QString arg("-arg");
+ const QStringList args{"-a", "-b", "-c"};
+
+ QTest::newRow("mixed-strings") << CommandLine{filePath, {"-A", arg, args}}
+ << filePath << (QStringList{"-A"} << arg << args);
+ }
+
+ void testConstructor()
+ {
+ QFETCH(CommandLine, command);
+ QFETCH(FilePath, executable);
+ QFETCH(QStringList, arguments);
+
+ QCOMPARE(command.executable(), executable);
+ QCOMPARE(command.arguments(), arguments.join(' '));
+ QCOMPARE(command.splitArguments(), arguments);
+ }
+
void testFromUserInput_data()
{
QTest::addColumn<QString>("input");