summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstringmatcher
diff options
context:
space:
mode:
authorAnton Kudryavtsev <anton.kudryavtsev@corp.mail.ru>2019-03-12 02:40:01 -0700
committerAnton Kudryavtsev <antkudr@mail.ru>2019-03-14 04:48:06 +0000
commitb35eec360d4d88d094094fb54c101fad6cee5768 (patch)
tree2e08d4a937c4b1988ee587b470b9c45d7fb5442d /tests/auto/corelib/tools/qstringmatcher
parent29a70348d4ed4f5acca82bfb9f73a1acf06c3aa8 (diff)
QStringMatcher: add QStringView support
While touching the code, deduplicate some methods. Change-Id: I28f469f0e9ae000a34466b0ecc604b5f3bd09e63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstringmatcher')
-rw-r--r--tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
index 8a55f54449..2d577bb0ab 100644
--- a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
+++ b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
@@ -100,6 +100,11 @@ void tst_QStringMatcher::indexIn()
matcher.setPattern(needle);
QCOMPARE(matcher.indexIn(haystack, from), indexIn);
+
+ const auto needleSV = QStringView(needle);
+ QStringMatcher matcherSV(needleSV);
+
+ QCOMPARE(matcherSV.indexIn(QStringView(haystack), from), indexIn);
}
void tst_QStringMatcher::setCaseSensitivity_data()
@@ -128,6 +133,7 @@ void tst_QStringMatcher::setCaseSensitivity()
matcher.setCaseSensitivity(static_cast<Qt::CaseSensitivity> (cs));
QCOMPARE(matcher.indexIn(haystack, from), indexIn);
+ QCOMPARE(matcher.indexIn(QStringView(haystack), from), indexIn);
}
void tst_QStringMatcher::assignOperator()