Add table-driven lexer tests for keywords and built-in types

Open Beginner friendly
#388 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
Half a day
Newbie friendliness
88/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
compilers, testing

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.

Description

good first issue needs testing

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.
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 6m
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wavefnd/Wave

All issues in wavefnd/Wave

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.