Skip to content

test: add unit tests for lexer raw string literals, lone dash, and single equals#349

Open
Aiudadadadf wants to merge 1 commit intojmespath:developfrom
Aiudadadadf:test/lexer-raw-string-equals-dash
Open

test: add unit tests for lexer raw string literals, lone dash, and single equals#349
Aiudadadadf wants to merge 1 commit intojmespath:developfrom
Aiudadadadf:test/lexer-raw-string-equals-dash

Conversation

@Aiudadadadf
Copy link

est_lexer.py had no unit-level coverage for three distinct code paths in lexer.py, even though the compliance suite exercises some of them indirectly at a higher level.

The first gap is the raw string literal path (the ' branch in okenize). _consume_raw_string_literal handles basic content, preserves interior whitespace, and applies
eplace("\'", "'") to unescape embedded single quotes, while leaving other backslash sequences intact. None of those behaviors had a dedicated unit test; four tests now cover them directly.

The second gap is error handling for two invalid token forms. A bare - with no following digits reaches a len(buff) > 1 guard that raises LexerError, and a = not followed by another = raises LexerError via a branch with distinct EOF vs. non-EOF position logic. Three tests now exercise these paths, including the EOF edge case. All 999 existing tests continue to pass.

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.

1 participant