Repository navigation
Conversation
Write strings as supplied instead of coercing them to numbers first. CheckString preserves their whitespace and representation while retaining the existing formatting for actual numbers. Cover io.write and file:write with output and return-value regressions.
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.
io.write("123 ")currently writes123, and strings such as"001.20 "or"0x10 "are reformatted as numbers. The shared write helper callsToNumberbefore checking whether an argument is already a string.Use
CheckStringdirectly: string bytes are preserved, while actual numbers still use the existingnumberToStringconversion. Regression coverage exercises bothio.writeandfile:write, including whitespace, leading zeros, hexadecimal/exponent strings, actual numbers, and the returned file handle.Fixes #92.
Validation on Go 1.25.0, darwin/arm64:
go test -vet=off -race ./...passes with the lua-tests submodule initialized. Existing tests requiringluacskip because it is not installed; the existing architecture-dependent test also skips.go vet -tests=false ./...passes.Default test vet reports the pre-existing non-niladic
ExampleFunctionin doc_test.go; the same error was verified on pristine upstream3f823f8.