From 34f4ec11bd2cf430146340b8a2d4a3db6abe4866 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 16 May 2024 09:55:16 +0200 Subject: [PATCH] CommandLine: Add a constructor test Change-Id: I5d5bf8e7f31017f16663103f560e598e2a003d50 Reviewed-by: hjk --- .../utils/commandline/tst_commandline.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/auto/utils/commandline/tst_commandline.cpp b/tests/auto/utils/commandline/tst_commandline.cpp index d884e47c8d6..aca984adf54 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("command"); + QTest::addColumn("executable"); + QTest::addColumn("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("input");