aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-03 20:48:23 +0200
committerDanilo M. <danix@danix.xyz>2026-08-04 12:54:10 +0200
commit4175f3e7314410a5e35bb3c06a0faf9065ce2e7a (patch)
tree8bb3b6c09d2337fd10351c103139f5e2e80a1e9d
parent3a3220471d2b10811e77fe942a6c58f53df316b0 (diff)
downloadqtmaildir-4175f3e7314410a5e35bb3c06a0faf9065ce2e7a.tar.gz
qtmaildir-4175f3e7314410a5e35bb3c06a0faf9065ce2e7a.zip
test(completion): make the lower-bound span test discriminate
date:las..today put the caret at the end of the lower bound, where the whole-bound span and the typed-so-far span are both 3 characters long, so the test passed even against a tokenizer that truncates at the caret and never sees the range separator. Moving the caret mid-bound with date:lastweek..today separates the two: 8 under correct code, 3 under the truncating one. Mutation-verified in both directions.
-rw-r--r--tests/test_querycompleter.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test_querycompleter.cpp b/tests/test_querycompleter.cpp
index 1d06f4b..aead30d 100644
--- a/tests/test_querycompleter.cpp
+++ b/tests/test_querycompleter.cpp
@@ -139,13 +139,17 @@ void TestQueryCompleter::rangeUpperBoundCompletes()
void TestQueryCompleter::rangeLowerBoundCompletes()
{
- // Cursor sits at offset 8, before the "..".
- const QString text = QStringLiteral("date:las..today");
+ // Cursor sits at offset 8, mid-way through the lower bound rather than at
+ // its end. End-of-bound would not discriminate: there the whole-bound span
+ // and the typed-so-far span happen to be the same length.
+ const QString text = QStringLiteral("date:lastweek..today");
const CompletionContext ctx = completionContext(text, 8);
QCOMPARE(ctx.kind, CompletionContext::Value);
QCOMPARE(ctx.stem, QStringLiteral("las"));
QCOMPARE(ctx.replaceFrom, 5);
- QCOMPARE(ctx.replaceLength, 3);
+ // Covers the whole lower bound, so accepting leaves no "tweek" tail.
+ QCOMPARE(ctx.replaceLength, 8);
+ QVERIFY(!ctx.allowRangeEntries);
}
void TestQueryCompleter::bareValueAllowsRelativeEntries()