Skip to content

Fix longest matching three-word assertion names - #211

Open
yousefissa wants to merge 1 commit into
lunarmodules:masterfrom
yousefissa:fix-three-word-assertion-matching
Open

yousefissa wants to merge 1 commit into
lunarmodules:masterfrom
yousefissa:fix-three-word-assertion-matching

Conversation

@yousefissa

@yousefissa yousefissa commented Oct 16, 2026 •

Copy link
Copy Markdown

When three_words_token and words_token are registered together, calling the longer assertion fails with unknown modifier/assertion: 'three'. While extending a matched suffix, extract_keys reuses the token it just consumed instead of looking at the next preceding token.

Correct that lookahead and add five public-API tests covering overlapping names, underscore/dot chaining, negation, and the shorter and standalone assertion controls. Each test unregisters its custom assertions afterward.

Related to #172. This addresses the overlapping three-word assertion case; the separate missing-intermediate-suffix case remains unchanged.

Validation on Lua 5.4.7:

  • Before the fix, the new tests produce three parser errors and two passing controls.
  • Full Busted suite: 214 passing, no failures, errors, or pending tests.
  • Luacheck: no warnings or errors across all 40 Lua files.

AI assistance (Codex) was used to prepare and review this patch and its tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant