diff options
Diffstat (limited to 'cmd/plutia/version_test.go')
| -rw-r--r-- | cmd/plutia/version_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/plutia/version_test.go b/cmd/plutia/version_test.go new file mode 100644 index 0000000..3869de6 --- /dev/null +++ b/cmd/plutia/version_test.go @@ -0,0 +1,31 @@ +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) + } + } +} |