summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qcommandlineparser
Commit message (Collapse)AuthorAgeFilesLines
* QCommandLineOption: optimize ctorsMarc Mutz2015-06-191-1/+1
| | | | | | | | | | | ...by moving common code into the Private ctor, and catering for C++11 move semantics a bit. Saves ~1.5KiB in text size on Linux GCC 4.9 C++11 release builds. Change-Id: I52ed7e47f76b69500a871844c0920e27fe51a127 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineParser: add parsing mode for options after argumentsDavid Faure2015-03-061-0/+37
| | | | | | | | | | | | | | | | | The new mode, ParseAsPositionalArguments, allows to interpret "application argument --opt" as having two positional arguments, "argument" and "--opt". This mode is useful for executables that aim to launch other executables (e.g. wrappers, debugging tools, etc.) or who support internal commands followed by options for the command. "argument" is the name of the command, and all options occurring after it can be collected and parsed by another command line parser, possibly in another executable. [ChangeLog][QtCore][QCommandLineParser] Add parsing mode for options after arguments, to allow treating them as more arguments. Change-Id: I48d5fcf90f2f59deda8422538b8ebf2680fae828 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineParser: add support for hiding options from --help.David Faure2015-02-231-0/+6
| | | | | | | | | [ChangeLog][QtCore][QCommandLineParser] Added support for hiding options from the --help output, with QCommandLineOption::setHidden(true). Task-number: QTBUG-44298 Change-Id: I62cc2a55428365c0bcc79d2e47c72c0c92104e74 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-112-12/+12
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Android: Fix QCommandLineParser testEskil Abrahamsen Blomfeldt2015-01-061-0/+9
| | | | | | | | | Skip the tests that require building and deploying an external command line application, since that's not how we do things on Android, and it's really not very relevant for that platform. Change-Id: I2c1985687e25fb0cf124b1d57c8ba60e37d2ff96 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Update license headers and add new license filesMatti Paaso2014-09-242-36/+20
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QCommandLineParser: support extremely concise option configuration in C++11Marc Mutz2014-08-061-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this commit to make the code in the test work: QCommandLineParser parser; parser.addOptions({ { "a", "The A option." }, { { "v", "verbose" }, "The verbose option." }, { { "i", "infile" }, "The input file.", "value" }, }); For this, QCommandLineParser needs a version of addOption that can take a list of options. That's what addOptions() is for. More importantly, the QCommandLineOption ctors mustn't be explicit. OTOH, any implicit conversion from QString or QStringList to QCommandLineOption is also undesirable. To solve this dilemma, add new QCommandLineOption ctors that just take one argument and are explicit, and make the existing ctors implicit. In order to avoid ambiguities, remove the default values of their resp. 2nd arguments. The new ctors are by intention not \since 5.4, as they are completely transparent to the user. Et voila, even better than getopt_long(3). [ChangeLog][QtCore][QCommandLineParser] Added addOptions() method. Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-241-2/+3
|\ | | | | | | Change-Id: I2defae1904154283446b069d151c3ef57302ec7b
| * Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-12-121-2/+3
| |\ | | | | | | | | | Change-Id: I0cd3b1b33e6d9bec729d941b06aeeb3d21851820
| | * Windows command line parsing: Do escape backslash.Friedemann Kleint2013-12-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will break network paths passed as command line arguments. Introduced by 4ff6951550cb6e39c3b31895c3af57037e90c9ac . Task-number: QTBUG-35432 Task-number: QTBUG-30628 Change-Id: Ice9ce15275ef69e9e9e82daf5a303e7c56294368 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-12-161-0/+12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qplatformtheme.h tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp Change-Id: Iecd3343d6a050b8764f78d809c4a1532aeba69e5
| * | QCommandLineParser: pluck some low-hanging fruit re: exception safetyMarc Mutz2013-12-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make QCommandLineParser::add{Help,Version}Option() QCommandLineOption::setDefaultValue() QCommandLineOptionPrivate::setNames() have transaction semantics: either they succeed, or they change nothing. It's trivial to provide this guarantee, so do it. Add a test for the surprising property that setDefaultValue("") resets defaultValues() to an empty QStringList instead of one that contains the empty string. Change-Id: I61623019de3c7d2e52c24f42cc2e23ec5fddc4da Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-11-262-22/+38
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
| * | QCommandLineParser: add word-wrapping algorithmDavid Faure2013-11-172-22/+38
| |/ | | | | | | | | | | | | | | Rather than breaking at column 79 precisely, break entire words, to improve readability. Change-Id: Ie30db00f0e6ed95cce87480c3b91804826c6076b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* / WinRT: Fix various test compilationsAndrew Knight2013-10-021-0/+4
|/ | | | | | | | | | | | | - Remove irrelevant test subdirs via .pro files - Follow WinCE codepaths where applicable - Replace unsupported Win32 APIs with WinRT equivalents This does not aim to fix any failures in the tests themselves; it only makes them compile. Change-Id: Ia82bc0cc402891f8f6238d4c261ee9152b51be80 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Expose QTest::currentAppName() and remove hard-coded argv[0] in testsTor Arne Vestbø2013-09-261-1/+10
| | | | | | | | Except where we're actually testing QCoreApplication::applicationName() and friends. Change-Id: I25514884c11f43a4f82b1f818f822dc3d79f69a3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* QCommandLineOption: improve runtime warningsDavid Faure2013-09-101-1/+1
| | | | | Change-Id: I48a278acf3a8eb0cfa829deb65cf65dfd8ec23af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix escape handling in qWinCmdArgsDavid Faure2013-09-102-0/+28
| | | | | | | | | | | | | | | | | | | | | -DKEY="VALUE" was correctly turned into -DKEY=VALUE, but -DKEY=\"VALUE\" was turned into -DKEY=\VALUE" due to the erroneous check ('quote' is still 0 when encountering the first '\' character). This fixes QCoreApplication::arguments() as used by moc.exe after porting to QCommandLineParser. Further investigation shows that double-quotes and single-quotes are handled differently. The tests now ensure that this parser respects what Windows sends in argv, and in particular that QTBUG-15379 doesn't regress, as well as fixing QTBUG-30628. Task-number: QTBUG-15379, QTBUG-30628 Change-Id: I95062c9a6022632b321b2f6fae3089f07be7b5c6 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QT_NO_PROCESS guards in tests where they are missingAndrew Knight2013-09-031-0/+8
| | | | | | | | | | A handful of tests lack QT_NO_PROCESS guards, making them non-compilable on Qt builds with no QProcess support. This commit does not change QProcess-specific tests, which should be left out of the build using the .pro file mechanism. Change-Id: Iac8562428abc1f59ccbb23bf5c3a919785e41f12 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Long live QCommandLineParser!David Faure2013-08-245-0/+637
The QCommandLineParser class provides a means for handling the command line options. QCoreApplication provides the command-line arguments as a simple list of strings. QCommandLineParser provides the ability to define a set of options, parse the command-line arguments, and store which options have actually been used, as well as option values. Done-with: Laszlo Papp <lpapp@kde.org> Change-Id: Ic7bebc10b3f8d8dd06ad0f4bb897c51d566e3b7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>