Skip to content

Commit 99e71af

Browse files
pajomaclaude
andcommitted
test(match-input): add #230 regression tests for week-token boundary
Proves recognizeWeek uses zero-width lookahead — no character consumed from following text. Covers: week+text, standalone week, w<num> priority. #230 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1da4e42 commit 99e71af

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/test/suite/match-input-vocab.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,25 @@ suite('MatchInput — tokenizer vocab & regression', () => {
171171
assert.strictEqual(r.week, 7);
172172
});
173173

174+
// --- #230 regressions: week-token boundary ---
175+
176+
test("#230 'task week Finalize Shoppinglist' → flag=task, full text preserved, hasWeek", async () => {
177+
const r = await make().parseInput('task week Finalize Shoppinglist');
178+
assert.ok(r.hasTask(), 'should have task flag');
179+
assert.ok(r.hasWeek(), 'should have week set');
180+
assert.strictEqual(r.text, 'Finalize Shoppinglist', 'text must not be truncated');
181+
});
182+
183+
test("#230 'week' alone → hasWeek, no crash", async () => {
184+
const r = await make().parseInput('week');
185+
assert.ok(r.hasWeek());
186+
});
187+
188+
test("#230 'w15' → week=15, no regression from recognizeWeekNum priority", async () => {
189+
const r = await make().parseInput('w15');
190+
assert.strictEqual(r.week, 15);
191+
});
192+
174193
// --- month + day ---
175194

176195
test("'Jun 1' produces a numeric offset", async () => {

0 commit comments

Comments
 (0)