Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't treat overflowing octal int as if decimal float #32

Merged
merged 4 commits into from
Sep 16, 2022

Conversation

jhump
Copy link
Member

@jhump jhump commented Sep 16, 2022

I recently landed a patch in protoc to make its handling of extremely large int literals more consistent:
protocolbuffers/protobuf#10555

I came back to protocompile to make sure its behavior was the same, and realized that protocompile had a bug: if an octal integer literal was too large to fit in a uint64, it would end up being parsed as if it were a decimal float 😨.

This fixes that, so its behavior matches the behavior of protoc (as of latest main branch).

Like in previous PR, I also went ahead and updated/reformatted an existing table-driven test so it uses test names and t.Run.

The test case is certain to be easier to review if you look commit-by-commit.

@jhump jhump requested a review from pkwarren September 16, 2022 14:00
for name, tc := range testCases {
tc := tc
t.Run(name, func(t *testing.T) {
handler := reporter.NewHandler(nil)
Copy link
Member

Choose a reason for hiding this comment

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

I think you need to call Parallel here for the linter.

@jhump jhump enabled auto-merge (squash) September 16, 2022 15:01
@jhump jhump merged commit c1eef11 into main Sep 16, 2022
@jhump jhump deleted the jh/more-range-tests branch September 16, 2022 15:03
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.

2 participants