18 lines
530 B
Go
18 lines
530 B
Go
package version
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
// Catches a source build that reports no usable identity or the wrong host platform.
|
|
func TestCurrentReportsUsableSourceBuildIdentity(t *testing.T) {
|
|
info := Current()
|
|
if info.Version == "" || info.Commit == "" || info.BuildTime == "" {
|
|
t.Fatalf("Current() = %#v, want non-empty build identity", info)
|
|
}
|
|
if info.OS != runtime.GOOS || info.Arch != runtime.GOARCH {
|
|
t.Fatalf("Current() platform = %s/%s, want %s/%s", info.OS, info.Arch, runtime.GOOS, runtime.GOARCH)
|
|
}
|
|
}
|