summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qregularexpression
Commit message (Collapse)AuthorAgeFilesLines
* QRegularExpressionMatch: add QStringView-related functionsGiuseppe D'Angelo2017-04-041-0/+3
| | | | | Change-Id: Ia81ba131cc2c7f56acb3312fbc7d62ffe5e18da4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge dev into 5.8Oswald Buddenhagen2016-08-221-1/+1
|\ | | | | | | Change-Id: I41ee7b50534b01cf042bed8bb8824ba2e5026a29
| * Use qtConfig throughout in qtbaseLars Knoll2016-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | Use the new qtConfig macro in all pro/pri files. This required adding some feature entries, and adding {private,public}Feature to every referenced already existing entry. Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | tst_QRegularExpression: clean upMarc Mutz2016-08-151-12/+14
|/ | | | | | | | | | | | - port Q_FOREACH to C++11 range-for (incl. one case of iterating over QHash::keys()) - port uses of inefficient QLists to QVector - add Q_DECLARE_TYPEINFO for types held in Qt containers Fixes errors pointed out by my tree's static checks. Change-Id: I30eb432528fa3008240b5c217d5f2f9ddc3679be Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Updated license headersJani Heikkinen2016-01-215-80/+55
| | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* tests/auto/corelib: Remove some placeholder formatting.Friedemann Kleint2015-10-221-6/+6
| | | | | | | | Use QByteArray/QString addition instead in loops and for test row names. Change-Id: Ieffb429efdc14aa5932b3fcdef5a18e13a62d35f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-09-252-15/+372
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/io.pri src/corelib/io/qdatastream.cpp src/corelib/io/qdatastream.h src/network/socket/qabstractsocket.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h src/widgets/styles/qgtkstyle.cpp tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro tests/auto/dbus/qdbusconnection/qdbusconnection.pro tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp Change-Id: I347549a024eb5bfa986699e0a11f96cc55c797a7
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-08-262-15/+372
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/snippets/code/doc_src_qmake-manual.pro qmake/doc/src/qmake-manual.qdoc src/corelib/io/qstorageinfo_unix.cpp src/corelib/tools/qbytearray.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp tests/auto/network/access/qnetworkreply/BLACKLIST Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
| | * QRegularExpression: fix matching over QStringRefsGiuseppe D'Angelo2015-08-182-15/+372
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Playing with the offset argument of pcre_exec is not equivalent to adjusting the pointer to the subject string. In particular, PCRE can go behind the offset to check for lookbehinds or "transition" metacharacters (\b, \B, etc.). This made the code that deals with QStringRefs not matching in behavior with the corresponding code dealing with QStrings. For instance, QString subject("Miss"); QRegularExpression re("(?<=M)iss"); re.match(subject.mid(1)); // doesn't match re.match(subject.midRef(1)); // matches!!! Instead, actually adjust the pointer to the subject string so that the behavior is identical. A broken test that relied on the equivalence is also removed. Change-Id: If96333241ef59621d7f5a6a170ebd0a186844874 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Tests: Remove CONFIG += parallel_test.Friedemann Kleint2015-09-053-3/+3
| | | | | | | | | | | | | | | | | | | | | The keyword no longer has a meaning for the new CI. Change-Id: Ibcea4c7a82fb7f982cf4569fdff19f82066543d1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Remove QT_DISABLE_DEPRECATED_BEFORE=0 from tests not using deprecated API.Friedemann Kleint2015-09-012-2/+0
|/ / | | | | | | | | Change-Id: I1955320e7639760b4383a53f37a506c8055933ef Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* / Add qHash(QRegExp) and qHash(QRegularExpression)Marc Mutz2015-05-051-0/+5
|/ | | | | | | | | | | | | | | | QReg*Exp*s can be compared for equality, so qHash should be overloaded, too. There was a (poor) private implementation of qHash(QRegExpEngineKey) already, which has now been replaced with a better one (the old one didn't take into account all the fields that make up equality, producing unnecessary collisions). [ChangeLog][QtCore][QRegExp] Added qHash(QRegExp). [ChangeLog][QtCore][QRegularExpression] Added qHash(QRegularExpression). Change-Id: I1d22fbcc0508018a3f94b4c24571b13ba6e07df2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Update copyright headersJani Heikkinen2015-02-115-30/+30
| | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-295-90/+50
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-245-90/+50
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | QRegularExpression: more QStringRef testsGiuseppe D'Angelo2014-09-121-0/+13
| | | | | | | | | | | | | | | | | | So far we've only tested matching against QStringRefs which were spanning the entire underlying QString. Instead, use the offset matching to also perform tests using "proper" substrings. Change-Id: Ia66e23f738b52997311ed2cf869e595079984292 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QRegularExpression: strenghten tests of matching at an offsetGiuseppe D'Angelo2014-09-021-32/+58
| | | | | | | | | | | | | | | | | | Instead of simply doing a match against a string S at offset O > 0 (and checking the result), test that the results never change when matching against the substring starting at (O - i) at offset i, 0 <= i <= O. Change-Id: Ib7fd648ca0a36b93d145267ebfb792c46ca4e4f5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QRegularExpression: add overloads matching over a QStringRefGiuseppe D'Angelo2014-09-021-14/+62
| | | | | | | | | | | | | | | | [ChangeLog][QtCore][QRegularExpression] Support for matching using QStringRef as the subject's string type has been added. Change-Id: Idb956bbbdf4213f9ebe035db32cd37cf3370c6bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QRegularExpression: lift common code in the autotestGiuseppe D'Angelo2014-09-021-77/+52
|/ | | | | | | | | Unify the code paths which test the normal match, the partial match and the global matches. Not only does this remove the duplication, but it will also enable the corresponding tests to be run over QStringRefs. Change-Id: Ia2cbe7a540bbe864b0975c9353697bc06c99c397 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QRegularExpression: add ways to force an immediate optimizationGiuseppe D'Angelo2014-05-065-2/+132
| | | | | | | | | | | | | | | The fact that we kick in a pattern study and possibly a JIT compilation after an undocumented number of usages is suboptimal, for a number or reasons: users may want to JIT compile a pattern immediately, and at the same time they may not want a random delay in the program (due to the pattern getting optimized at a random usage). So: add an optimize() call to force an immediate pattern optimization, and a pattern option to force an optimization on the first usage. Change-Id: I95efdecfd31f11ca7cceb9c05037df613601a11c Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: print a warning if (?J) is used in a patternGiuseppe D'Angelo2013-02-122-0/+34
| | | | | | | | | (?J) inside a pattern string can be used to allow or disallow duplicated capturing group names in the pattern string itself. Although PCRE supports duplicated names, in Qt we don't yet. Change-Id: I21cd0c41273cd7ef42870ced3a0fad6ba7035cbc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: add method for extracting the capturing group namesGiuseppe D'Angelo2013-02-052-0/+83
| | | | | | | | | | | | | | | | It may be useful to know which named capturing groups are defined in an regular expression, and for each of them, what's the corresponding index. This commit adds the needed method to QRegularExpression. Note that extracting the information doesn't happen while holding the mutex in the private -- pcre_fullinfo just reads information from the compiled pattern, so that's thread-safe. Task-number: QTBUG-29079 Change-Id: I50c00ee860f06427c2e6ea10417d5c0733cc8303 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce default ctors for QRegularExpressionMatch(Iterator)Giuseppe D'Angelo2013-01-142-0/+26
| | | | | | | | This allows to put them in containers, and to enable subsequent features for QString. Change-Id: I3b3fe695ffe6930331ed9f670738376722e0fc36 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge "Merge branch 'stable' into dev" into refs/staging/devJędrzej Nowacki2013-01-071-1/+0
|\
| * Core: Remove declaration of built-in and automatic metatypes.Stephen Kelly2013-01-041-1/+0
| | | | | | | | | | | | | | | | These types are either built-in or 'automatically declared' and so don't need to be explicitly declared as metatypes. Change-Id: I54523eb854619917123d8816d3cd6c3a1f5b4c55 Reviewed-by: David Faure <david.faure@kdab.com>
* | Introduce QRegularExpression::NoMatch match typeGiuseppe D'Angelo2013-01-071-21/+67
| | | | | | | | | | | | | | | | | | | | This match type doesn't do any match at all; it's only necessary to properly introduce default constructors for QRegularExpressionMatch and QRegularExpressionMatchIterator (since they return the match type that created them). Change-Id: Ibfe92459c7fdd23129cf3afe073cd443c461ddeb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Improve QRegularExpression autotestsGiuseppe D'Angelo2013-01-071-0/+9
|/ | | | | | | | | Check that the regular expression, the match type and the match options returned by QRegularExpression/QRegularExpressionIterator are the same ones passed to match / globalMatch. Change-Id: Ibd282379bb60b53d614b1d56a7e08b3d6c236da6 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-224-93/+93
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Set the Qt API level to compatibility mode in all tests.Thiago Macieira2012-08-012-0/+2
| | | | | | | | | | | Qt 5.0 beta requires changing the default to the 5.0 API, disabling the deprecated code. However, tests should test (and often do) the compatibility API too, so turn it back on. Task-number: QTBUG-25053 Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QRegularExpression: add more test dataGiuseppe D'Angelo2012-04-131-0/+111
| | | | | | Change-Id: I44d19f976ced7b073f66d0ea943fafea37940c48 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QRegularExpression: minor fix to captureIndexForNameGiuseppe D'Angelo2012-03-082-1/+59
| | | | | | | | | | | | Although passing a null pointer to pcre16_get_stringnumber for the compiled pattern should simply make it error out, it's actually an undocumented behaviour, so let's stay safe and add an explicit check. Tests for this codepath are added. Change-Id: Ifd9c87874f6812ba487104ec1a5bbc83c3b16761 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: improve JIT memory handlingGiuseppe D'Angelo2012-03-082-0/+29
| | | | | | | | | | | | | | | | | PCRE's JIT uses by default 32K on the pcre_exec caller's stack. This is fine for most situations, but in some cases (esp. patterns with lot of recursion) more memory is required. Therefore, if a match execution fails due to exhausting JIT memory, we let PCRE allocate up to 512KB to be used for the JIT's stack. The pointer to the allocated memory is put in thread local storage (so it can be reused from the same thread, if needed, and automatically goes away when the thread dies). Change-Id: Ica5fb7d517068befff88ebb198a603a26ec5d8a7 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: add optimizations autotestGiuseppe D'Angelo2012-03-078-44/+213
| | | | | | | | | | | | | | | Exporting the counter that controls the optimization of a compiled pattern lets us to forcibly optimize all patterns. Therefore, two tests are now run: one with default optimization values and another one which always optimizes the pattern. The counter itself was renamed with a qt_ prefix and put inside the Qt compilation namespace (thanks to rohanpm for pointing it out). Change-Id: I56602433d37adc127772b2d0d2cdaf2e49d43c71 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: fix autotestGiuseppe D'Angelo2012-03-071-2/+3
| | | | | | | | | | | | Some minor fixes: obviously, a valid match always come from a valid regular expression, but a valid regular expression can create an invalid match (internal error during matching). Also, testing an invalid iterator should silence the emitted warnings. Change-Id: I585bb99a81e22f108601fd66bf30b56e0229d68b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: add captureCount()Giuseppe D'Angelo2012-03-061-0/+31
| | | | | | | | QRegularExpression::captureCount() returns the number of capturing groups inside the regular expression pattern. Change-Id: Ib90ce67c67d06ab2966f0c98bd91da21defc156d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: improve operator==, add dedicated autotestGiuseppe D'Angelo2012-03-061-5/+59
| | | | | | | | Trivial change: compare dpointers first, then the data. Added test function for operator==. Change-Id: I33ac64a59db4ccad56c30be17622187e42415f38 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QRegularExpression: add QRegularExpression* set of classesGiuseppe D'Angelo2012-03-063-0/+1155
Added QRegularExpression, QRegularExpressionMatch and QRegularExpressionMatchIterator as PCRE-enabled, regexp classes. Documentation is included, as well as a first round of autotests. Task-number: QTBUG-23489 Change-Id: Id47031b80602c913ccd2fd740070e3024ea06abc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>