package main import ( "strings" "testing" ) func TestFormatVersionIncludesBuildMetadata(t *testing.T) { oldVersion, oldCommit, oldBuildDate := version, commit, buildDate version = "v0.1.0" commit = "abc123" buildDate = "2026-02-26T00:00:00Z" t.Cleanup(func() { version = oldVersion commit = oldCommit buildDate = oldBuildDate }) out := formatVersion() checks := []string{ "Version: v0.1.0", "Commit: abc123", "BuildDate: 2026-02-26T00:00:00Z", "GoVersion: go", } for _, want := range checks { if !strings.Contains(out, want) { t.Fatalf("version output missing %q: %s", want, out) } } }