Add lexer diagnostic tests for string and character escapes
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Why
String and character scanners already produce structured E1003–E1005 diagnostics, but the lexer crate has no tests that lock down valid escapes, malformed escapes, or source positions.
## Scope
- Add positive cases for the supported string and character escapes.
- Add negative cases for unterminated literals, dangling escapes, invalid `\xNN` escapes, empty character literals, and multi-character character literals.
- Assert diagnostic code, message fragment, file name, line, and column.
- Include at least one valid non-ASCII literal.
- Keep the currently documented escape set unchanged.
## Likely files
- `front/lexer/src/literals.rs`
- A new test file under `front/lexer/tests/`
## Completion criteria
- [ ] E1003, E1004, and E1005 paths have direct regression coverage.
- [ ] Both valid and invalid literals are tested.
- [ ] Assertions include source location data.
- [ ] `cargo test -p lexer --locked` passes.
Contributor guide
Research direction
Start with front/lexer/src/literals.rs to review the existing string and character escape diagnostics, then add focused cases in a new test file under front/lexer/tests/. Run cargo test -p lexer --locked and verify E1003, E1004, and E1005 coverage for valid and invalid literals, including diagnostic messages and source locations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100