diff options
Diffstat (limited to 'tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index d5b3323506..cbbb30a598 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -69,6 +69,7 @@ private slots: void testUnknownOptionErrorHandling(); void testDoubleDash_data(); void testDoubleDash(); + void testDefaultValue(); void testProcessNotCalled(); void testEmptyArgsList(); void testMissingOptionValue(); @@ -322,6 +323,17 @@ void tst_QCommandLineParser::testDoubleDash() QCOMPARE(parser.unknownOptionNames(), QStringList()); } +void tst_QCommandLineParser::testDefaultValue() +{ + QCommandLineOption opt(QStringLiteral("name"), QStringLiteral("desc"), + QStringLiteral("valueName"), QStringLiteral("default")); + QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default"))); + opt.setDefaultValue(QStringLiteral("")); + QCOMPARE(opt.defaultValues(), QStringList()); + opt.setDefaultValue(QStringLiteral("default")); + QCOMPARE(opt.defaultValues(), QStringList(QStringLiteral("default"))); +} + void tst_QCommandLineParser::testProcessNotCalled() { QCoreApplication app(empty_argc, empty_argv); |