Skip to content

Add unit tests for parser and lexer#49

Merged
Alonely0 merged 1 commit into
uutils:mainfrom
Franklin-Qi:feature-task#43-parser-and-lexer-add-more-tests
Jun 17, 2026
Merged

Add unit tests for parser and lexer#49
Alonely0 merged 1 commit into
uutils:mainfrom
Franklin-Qi:feature-task#43-parser-and-lexer-add-more-tests

Conversation

@Franklin-Qi

@Franklin-Qi Franklin-Qi commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Expand test coverage for the parser and lexer using existing patterns: test_parser! macro assertions for AST s-expressions and token-slice comparisons for the lexer.

Parser [Twelve new tests have been added (17 → 29)] :

  • switch/case/default (including error cases)
  • getline variants (<, |, |&)
  • printf, control flow (next, nextfile, continue, return, exit)
  • print redirection (>, >>, |, |&)
  • regex matching (, !)
  • function and indirect calls
  • compound assignments (-=, *=, /=, ^=, %=)
  • builtin variables, concurrent rules, namespace
  • unary operators and division

Lexer [18 new tests have been added (24 → 42) ] :

  • operators, compound assignments, and slash-assign disambiguation
  • control-flow keywords and builtin variables (including ARGIND)
  • typed regex, comments, directives (load, namespace)
  • concurrent (non-GNU mode) and indirect calls (foo, ns::bar)
  • regex literals, getline/print redirection, func (POSIX fallback)

Tests: cargo test -p lexer -p parser

Closes: #43

Expand test coverage for the parser and lexer using existing patterns: test_parser! macro assertions for AST s-expressions and token-slice comparisons for the lexer.

Closes: uutils#43
@Franklin-Qi Franklin-Qi force-pushed the feature-task#43-parser-and-lexer-add-more-tests branch from 540a0bc to e75a39d Compare June 16, 2026 10:00

@Alonely0 Alonely0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing, hands down. Tysm! We can merge right away :)

@Alonely0 Alonely0 merged commit 1b96ee9 into uutils:main Jun 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser, lexer: add more tests

2 participants