test: add coverage for normalizeVerString#1341
Conversation
normalizeVerString strips characters that aren't valid in a semantic version pre-release/build-metadata string (i.e. not in semanticAlphabet). Add a table-driven test covering pass-through of valid strings and the stripping of spaces, disallowed punctuation, non-ASCII runes, and fully-invalid input. Signed-off-by: 0xfandom <kashyapshivank01@gmail.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive unit testing for the normalizeVerString utility function. By implementing a table-driven test suite, it ensures that version strings are correctly sanitized according to semantic versioning requirements without altering existing application logic. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new test file version_test.go to verify the behavior of the normalizeVerString function. The tests cover various scenarios, including empty strings, valid alphanumeric characters, hyphens, dots, spaces, disallowed punctuation, non-ASCII runes, and full semver pre-release strings. There are no review comments to address, and we have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
@0xfandom, remember to re-request review from reviewers when ready |
Change Description
normalizeVerString(inversion.go) strips any character that isn't valid in a semantic-version pre-release / build-metadata string (i.e. not part ofsemanticAlphabet). It's used when building the version string but had no unit test.This adds a table-driven
TestNormalizeVerStringcovering:-,.)_,+,/), and non-ASCII runesNo behaviour change.
I've intentionally left out a release-notes entry since this is test-only and has no user-facing impact, matching the approach taken in #1334. Happy to add one if you'd prefer.
Steps to Test
Pull Request Checklist