From 4175f3e7314410a5e35bb3c06a0faf9065ce2e7a Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 3 Aug 2026 20:48:23 +0200 Subject: 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. --- tests/test_querycompleter.cpp | 10 +++++++--- 1 file 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() -- cgit v1.2.3