(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestSetVersionAndGetVersion(t *testing.T) { |
| 10 | // Save original version |
| 11 | originalVersion := compilerVersion |
| 12 | defer func() { compilerVersion = originalVersion }() |
| 13 | |
| 14 | tests := []struct { |
| 15 | version string |
| 16 | }{ |
| 17 | {"1.0.0"}, |
| 18 | {"dev"}, |
| 19 | {"v2.3.4"}, |
| 20 | {""}, |
| 21 | } |
| 22 | |
| 23 | for _, tt := range tests { |
| 24 | t.Run(tt.version, func(t *testing.T) { |
| 25 | SetVersion(tt.version) |
| 26 | if got := GetVersion(); got != tt.version { |
| 27 | t.Errorf("GetVersion() = %q, want %q", got, tt.version) |
| 28 | } |
| 29 | }) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | func TestSetIsReleaseAndIsRelease(t *testing.T) { |
| 34 | // Save original isReleaseBuild |
nothing calls this directly
no test coverage detected