Skip to content

Add regression tests for numeric literal visitors (#128) - #158

Merged
paulirwin merged 1 commit into
masterfrom
test/128-numeric-literal-coverage
Aug 14, 2026
Merged

paulirwin merged 1 commit into
masterfrom
test/128-numeric-literal-coverage

Conversation

@paulirwin

Copy link
Copy Markdown
Owner

Summary

Issue #128 reported a System.FormatException when converting binary int constants such as 0b10. 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:

static final int FLAG_LONG_FRAME = 0b10;
static final int FLAG_COMMAND_FRAME = 0b100;

converts cleanly to:

static readonly int FLAG_LONG_FRAME = 0b10;
static readonly int FLAG_COMMAND_FRAME = 0b100;

Why this PR

The binary literal path only had indirect coverage via the BinaryLiterals.java integration test, and only for local variables — never for fields, and never at the visitor level. IntegerLiteralExpressionVisitor and LongLiteralExpressionVisitor had no direct unit tests at all.

This adds two theories covering both visitors across every base they handle:

  • binary, including uppercase 0B and underscore separators (0b1_0000)
  • hex (0x1F)
  • octal (010)
  • decimal

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

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>
@paulirwin
paulirwin merged commit c2c1259 into master Aug 14, 2026
5 checks passed
@paulirwin
paulirwin deleted the test/128-numeric-literal-coverage branch August 14, 2026 21:28
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