test(rename): cover no-arg PascalCase derivation from the git remote#248
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
Adds a Case 4 to
scripts/rename-placeholders.test.shthat exercises the script's no-argument path — deriving a PascalCase project name 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 carries real, easy-to-break logic — URL parsing plus the awk segment-split/capitalise (
my-cool-app→MyCoolApp) — yet every existing test case passes an explicit name (Widget,Acme.Widget, …), so the entire derivation branch was unexercised. A regression there ships a wrongly-named scaffold to anyone who runs the default.What the new case pins
https://github.com/acme/my--cool.app.git→MyCoolApp(doubled-and the.collapse to a single token); asserts the.slnx/src/rename and the repointed namespace, and that theExampleoriginal is gone.git@github.com:acme/widget-svc.git→WidgetSvc(proves thegit@host:owner/repo.gitform derives identically).make_copy()inits a git repo with no remote, so each sub-case adds its ownorigin. No build is run in the new cases (Case 2 already covers build/test); the cleanup trap is extended to the two new throwaway copies.Validation
sh scripts/rename-placeholders.test.sh→ PASS (all 4 cases; build/test still green).toupper()from the awk derivation makes the script emitmycoolappand Case 4a fails as expected; restored.shellcheck -s shclean. Test-only change —rename-placeholders.shis untouched.The
go-templaterename script has the same untested derive-from-remote branch (module-path parsing); a sibling PR will cover it.