aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/tst_tools.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2012-10-10 12:25:22 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2012-10-10 18:37:59 +0200
commitfb59966b904a5df4fbad9c71e23fdbd388f8e9a8 (patch)
tree83854a8018ba6d11825b6accabc204d2b5c4137c /tests/auto/tools/tst_tools.cpp
parent1a20a07bf12dbe684d919e0b2a17247d93794d91 (diff)
Sanitize the semantics of the command line verbosity setting.
Allow increasing and decreasing the log level via -v and -q, respectively, as well as setting an absolute value via --log-level. Improve the help output along the way. Change-Id: I5d756f41d34c577aa52775b9664c773d89956a94 Task-number: QBS-80 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/tools/tst_tools.cpp')
-rw-r--r--tests/auto/tools/tst_tools.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/tools/tst_tools.cpp b/tests/auto/tools/tst_tools.cpp
index 8a57ddc0f..962e749b7 100644
--- a/tests/auto/tools/tst_tools.cpp
+++ b/tests/auto/tools/tst_tools.cpp
@@ -45,12 +45,20 @@ private slots:
args << "--products" << "blubb";
args << "--changed-files" << "foo,bar";
qbs::CommandLineOptions options;
- options.parseCommandLine(args);
- QCOMPARE(qbs::Logger::instance().level(), qbs::LoggerDebug);
+ QVERIFY(options.parseCommandLine(args));
+ QCOMPARE(qbs::Logger::instance().level(), qbs::LoggerTrace);
QCOMPARE(options.command(), qbs::CommandLineOptions::BuildCommand);
QCOMPARE(options.selectedProductNames(), QStringList() << "blubb");
QCOMPARE(options.changedFiles(), QStringList() << "foo" << "bar");
QVERIFY(options.isKeepGoingSet());
+ QVERIFY(options.parseCommandLine(QStringList() << "-vvvqqq"));
+ QCOMPARE(qbs::Logger::instance().level(), qbs::Logger::defaultLevel());
+ QVERIFY(options.parseCommandLine(QStringList() << "-vvqqq"));
+ QCOMPARE(qbs::Logger::instance().level(), qbs::LoggerWarning);
+ QVERIFY(options.parseCommandLine(QStringList() << "-vvvqq"));
+ QCOMPARE(qbs::Logger::instance().level(), qbs::LoggerDebug);
+ QVERIFY(options.parseCommandLine(QStringList() << "--log-level" << "trace"));
+ QCOMPARE(qbs::Logger::instance().level(), qbs::LoggerTrace);
}
void testInvalidCommandLine()
@@ -63,6 +71,7 @@ private slots:
QVERIFY(!options.parseCommandLine(QStringList() << "-j" << "0")); // Wrong argument.
QVERIFY(!options.parseCommandLine(QStringList() << "--products")); // Missing argument.
QVERIFY(!options.parseCommandLine(QStringList() << "--changed-files" << ",")); // Wrong argument.
+ QVERIFY(!options.parseCommandLine(QStringList() << "--log-level" << "blubb")); // Wrong argument.
}
void testFileInfo()