CommandLine: Add a constructor test

Change-Id: I5d5bf8e7f31017f16663103f560e598e2a003d50
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-05-16 09:55:16 +02:00
parent 7e4c7aa779
commit 34f4ec11bd

View File

@@ -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");