MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestIsLocalBuild

Function TestIsLocalBuild

cmd/codehamr/main_test.go:14–33  ·  view source on GitHub ↗

TestIsLocalBuild pins the contract: `go run` ("dev"), dirty-tree builds, clean-tree builds past the last tag (git describe shape), and tag-less clones (bare short sha) are all local and skip self-update; else the updater downgrades unreleased work to the last published release (a non-release hash al

(t *testing.T)

Source from the content-addressed store, hash-verified

12// non-release hash always reads as "stale"). Only exact release tags
13// self-update.
14func TestIsLocalBuild(t *testing.T) {
15 cases := []struct {
16 in string
17 want bool
18 }{
19 {"dev", true},
20 {"v1.2.3-dirty", true},
21 {"v0.1.0-5-g1a2b3c4-dirty", true},
22 {"v0.1.0-5-g1a2b3c4", true}, // clean tree, 5 commits past the tag: unreleased work
23 {"5290930", true}, // tag-less clone: `git describe --always` bare sha
24 {"v1.2.3", false},
25 {"v1.2.3-gamma", false}, // prerelease tag: "-g" but not hex, still a release
26 {"", false},
27 }
28 for _, c := range cases {
29 if got := isLocalBuild(c.in); got != c.want {
30 t.Errorf("isLocalBuild(%q) = %v, want %v", c.in, got, c.want)
31 }
32 }
33}
34
35// TestReexecGuardOverridesPreexistingValue pins the loop-guard env semantics
36// maybeSelfUpdate relies on: the environment handed to reExec must carry

Callers

nothing calls this directly

Calls 1

isLocalBuildFunction · 0.85

Tested by

no test coverage detected