srs/internal/version/version_test.go
winlin 43576e6036 Proxy: Add unit tests for internal/version with 100% coverage.
Cover all five version helpers (VersionMajor, VersionMinor,
VersionRevision, Version, Signature). The revision assertion checks
that the value is positive rather than pinning an exact number so the
test survives future version bumps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 20:03:25 -04:00

35 lines
780 B
Go

// Copyright (c) 2026 Winlin
//
// SPDX-License-Identifier: MIT
package version
import (
"fmt"
"testing"
)
func TestVersionComponents(t *testing.T) {
if got := VersionMajor(); got != 7 {
t.Fatalf("VersionMajor = %d, want 7", got)
}
if got := VersionMinor(); got != 0 {
t.Fatalf("VersionMinor = %d, want 0", got)
}
if got := VersionRevision(); got <= 0 {
t.Fatalf("VersionRevision = %d, want > 0", got)
}
}
func TestVersion_FormatsMajorMinorRevision(t *testing.T) {
want := fmt.Sprintf("%d.%d.%d", VersionMajor(), VersionMinor(), VersionRevision())
if got := Version(); got != want {
t.Fatalf("Version = %q, want %q", got, want)
}
}
func TestSignature(t *testing.T) {
if got := Signature(); got != "SRSX" {
t.Fatalf("Signature = %q, want SRSX", got)
}
}