aboutsummaryrefslogtreecommitdiff
path: root/cmd/plutia/version_test.go
blob: 0e3b8a413adf71ffafddfb0d8805d0d31370baf4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
		}
	}
}