test(rename): cover no-arg module-path derivation from the git remote#132
Merged
Conversation
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.
What
Extends
scripts/rename-placeholders.test.shto exercise the script's no-argument path — deriving the Go module path fromorigin's GitHub remote.Why
rename-placeholders.shis the first thing a newcomer runs after Use this template, and running it with no argument is its documented default:That branch parses the remote URL — strip everything up to
github.com, handle the scp:vs https/separator, drop the.gitsuffix — but every existing test case passes an explicit module path, so the derivation was unexercised. A regression there ships a wrongly-pathed scaffold to anyone who runs the default.What the new cases pin
https://github.com/example-owner/renamed-project.git→module github.com/example-owner/renamed-project(asserts thego.modrepoint and no lingering template path).git@github.com:example-owner/renamed-project.git→ the same derived path (proves thegit@host:owner/repo.gitform parses identically).A small
make_copy()helper builds each fresh throwaway repo (the existing copy is already renamed); the cleanup trap is extended to the two new copies.Validation
sh scripts/rename-placeholders.test.sh→ PASS (all cases;go build/go teststill green)..git-suffix strip from the derivation makesgo.modcarry…renamed-project.gitand the https case fails as expected; restored.shellcheck -s shclean. Test-only change —rename-placeholders.shis untouched.Sibling to devantler-tech/dotnet-template#248, which covers the same untested derive-from-remote branch (awk PascalCase) in the .NET template.