Open
Conversation
This commit updates the project to use Go 1.22.
Changes include:
- Updated `go.mod` to `go 1.22`.
- Updated the GitHub Actions workflow (`.github/workflows/test.yml`):
- Tests now run against Go 1.21.x and 1.22.x.
- Upgraded `golangci/golangci-lint-action` to `v3.7.0`.
- Upgraded `golangci-lint` version to `v1.55`.
- Ran `go mod tidy` to ensure module files are consistent.
All tests and linters pass with these new versions. No code changes were required to adapt to the updated Go version or linters.
This commit significantly enhances test coverage for the string alignment and
case conversion functionalities by adding numerous new table-driven test cases.
Key changes include:
1. **Enhanced `align_test.go`:**
* Added comprehensive tests for `Align`, `AlignLeft`, `AlignRight`,
`AlignCenter`, and `CenterText`.
* Covered edge cases such as empty strings, strings with only spaces,
zero width, width less than string length, and various newline scenarios.
* Included tests for multi-byte Unicode characters to ensure correct handling.
2. **Enhanced `case_test.go`:**
* Added comprehensive tests for `ToSnakeCase`, `ToCamelCase`, and
`SplitCamelCase`.
* Covered scenarios like multiple consecutive spaces, leading/trailing
spaces, strings already in the target case, and strings with numbers.
* For `SplitCamelCase`, added complex cases including mixed alphanumeric
sequences (e.g., "Version10Release2"), various acronym and number
combinations (e.g., "SKU1000", "NASA2024Projects"), and challenging
upper/lower/digit transitions (e.g., "userID", "IPAddress").
* Included Unicode examples and tests for non-camel-case inputs.
All new and existing tests pass, and the codebase conforms to `golangci-lint`
standards.
This work addresses your request to improve test coverage and ensure
robustness of these utility functions. While an initial attempt to retrieve
quantitative test coverage data faced difficulties with the reporting mechanism,
a qualitative analysis guided the selection of these key areas for test
enhancement.
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.
This commit updates the project to use Go 1.22.
Changes include:
go.modtogo 1.22..github/workflows/test.yml):golangci/golangci-lint-actiontov3.7.0.golangci-lintversion tov1.55.go mod tidyto ensure module files are consistent.All tests and linters pass with these new versions. No code changes were required to adapt to the updated Go version or linters.