This function will also be utiliized for specifying tests for the specialized spur types coming up, so rather than duplicate the function, it's best to make it a proper test helper defined outside a specific unit test suite.
As the next work in line will introduce new, specialized spur types designed to replace the current 'legacy spurs', it is wise to clarify existing search-graph unit tests and which sections of the code they actually target. We'll eventually drop behaviors specific to 'legacy' spurs, but those that apply to the new incoming specialized spur types should be preserved.
At the same time, it may be wise to improve the unit testing of each specific type by placing each within its own specialized unit-test suite, then adding new tests that test and clarify the role of each type.
Build-bot: skip build:web
Test-bot: skip
The removed bits of code were already refactored into LegacyQuotientSpur's implementation. They just... weren't removed from their original source.
There's a chance that the original removal got undone during a rebase, but either way, it's best to do this cleanup now, as this code would impact some of the specialized spur code coming up.
Build-bot: skip build:web
Test-bot: skip
test(core): add LDML baseline test with minimal keyboard
This replaces and enables the commented `k_000_null_keyboard` test which didn't work because keys that are not on any layer don't produce output. This instead defines a minimal keyboard with just two keys and then tests typing a key that is on the keyboard followed by a key not on the keyboard.
refactor(core): simplify loop for removing text
Instead of using an iterator to loop over the context items, incrementing a counter on each iteration, and then finally removing the calculated number of context items from the list, this change loops through the list and looks at the last context item, removing it if necessary.
Follows: #15596
fix(core): fix iterator in backspace handling
This change replaces the reverse iterator loop that holds a stale iterator across `pop_back()` calls with a pattern that directly accesses `context.back()` on each iteration. This avoids undefined behavior from iterator invalidation when mutating the list or vector.
While so far the previous code didn't show problems, it might still access released memory depending on the implementation. The documentation for `pop_back()` says "References and iterators to the erased element are invalidated", so the previous implementation was clearly wrong.
This replaces and enables the commented `k_000_null_keyboard` test which
didn't work because keys that are not on any layer don't produce output.
This instead defines a minimal keyboard with just two keys and then tests
typing a key that is on the keyboard followed by a key not on the keyboard.
Test-bot: skip
Instead of using an iterator to loop over the context items, incrementing
a counter on each iteration, and then finally removing the calculated
number of context items from the list, this change loops through the list
and looks at the last context item, removing it if necessary.
Follows: #15596
Test-bot: skip
Production code uses a list of context items, so this change modifies
the tests to also use a list instead of a vector to more closely match
production code.
Addresses code review comment.
Test-bot: skip
This change replaces the reverse iterator loop that holds a stale iterator
across `pop_back()` calls with a pattern that directly accesses
`context.back()` on each iteration. This avoids undefined behavior from
iterator invalidation when mutating the list or vector.
While so far the previous code didn't show problems, it might still access
released memory depending on the implementation. The documentation for
`pop_back()` says "References and iterators to the erased element are
invalidated", so the previous implementation was clearly wrong.
Test-bot: skip
The command shortcuts that were used by Web
scripts to create bundles via `esbuild` were not
properly handling the $KEYMAN_ROOT path when it
contained a space. These changes will rectify
this behavior and permit builds for such cases.
Build-bot: skip build:web
Test-bot: skip