From 43576e60365cc3a04ab92829c7288bb727acec56 Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 19 Apr 2026 20:03:25 -0400 Subject: [PATCH] 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) --- internal/version/version_test.go | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 internal/version/version_test.go diff --git a/internal/version/version_test.go b/internal/version/version_test.go new file mode 100644 index 000000000..786131059 --- /dev/null +++ b/internal/version/version_test.go @@ -0,0 +1,34 @@ +// 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) + } +}