Add table-driven lexer tests for keywords and built-in types
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Why
The lexer currently has no unit tests. Keyword and built-in type classification in `front/lexer/src/ident.rs` is a compact, stable surface that is well suited to a first contribution.
## Scope
- Add table-driven tests in the lexer crate for every language keyword and built-in type spelling.
- Verify exact-boundary behavior: for example, `fun` is a keyword while `funny` is an identifier.
- Cover `ptr` and `array`, which intentionally remain identifier tokens for the type parser.
- Verify the token lexeme and line number as well as the token kind.
- Do not change the Wave grammar or add new keywords.
## Likely files
- `front/lexer/src/ident.rs`
- A new test module under `front/lexer/tests/`
## Completion criteria
- [ ] Every keyword and built-in type in `TokenType` has an assertion.
- [ ] Prefix/suffix identifier cases are covered.
- [ ] `cargo test -p lexer --locked` passes.
- [ ] Existing parser behavior is unchanged.
Contributor guide
Research direction
Start with front/lexer/src/ident.rs and inspect TokenType’s keyword and built-in type spellings. Add table-driven tests in a module under front/lexer/tests/, including exact-boundary cases, ptr and array, token lexemes, and line numbers. Run cargo test -p lexer --locked; done means every listed token is asserted and parser behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- Half a day
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100