Add regression tests for numeric literal visitors (#128) - #158
Merged
Merged
Conversation
Issue #128 reported a FormatException converting binary int constants such as `0b10`. That crash was already fixed by 9957153 ("Support binary literals, #83"), which landed after the 3.0.0 build the reporter used. The binary literal path only had indirect coverage via the BinaryLiterals.java integration test, and only for local variables. Add direct unit tests for IntegerLiteralExpressionVisitor and LongLiteralExpressionVisitor covering binary (including uppercase 0B and underscore separators), hex, octal, and decimal literals, so the regression stays covered at the visitor level. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #128 reported a
System.FormatExceptionwhen converting binary int constants such as0b10. That crash is already fixed on master — commit 9957153 ("Support binary literals, #83") landed after the 3.0.0 build the reporter was using.Verified with the reporter's exact snippet through the CLI:
converts cleanly to:
Why this PR
The binary literal path only had indirect coverage via the
BinaryLiterals.javaintegration test, and only for local variables — never for fields, and never at the visitor level.IntegerLiteralExpressionVisitorandLongLiteralExpressionVisitorhad no direct unit tests at all.This adds two theories covering both visitors across every base they handle:
0Band underscore separators (0b1_0000)0x1F)010)No production code changes. This PR is test-only coverage; #128 can be closed as already fixed.
Test plan
dotnet test— 284 passed, 0 failed🤖 Generated with Claude Code