This repository has been archived by the owner on Feb 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trim 'beta' out of go version strings
This is currently broken, so go1.6beta2 will produce `go1.6beta1` instead of `go1.6`. Fixes #402
- Loading branch information
Edward Muller
committed
Jan 21, 2016
1 parent
d84b24d
commit 64044a2
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func TestTrimGoVersion(t *testing.T) { | ||
var cases = []struct { | ||
in, out string | ||
err bool | ||
}{ | ||
{in: "go1.5", out: "go1.5", err: false}, | ||
{in: "go1.5beta1", out: "go1.5", err: false}, | ||
{in: "go1.5.1", out: "go1.5", err: false}, | ||
{in: "devel", out: "devel", err: false}, | ||
{in: "boom", out: "", err: true}, | ||
} | ||
|
||
for _, c := range cases { | ||
mv, err := trimGoVersion(c.in) | ||
if err != nil && !c.err { | ||
t.Errorf("Unexpected error: %s", err) | ||
} | ||
if mv != c.out { | ||
t.Errorf("Expected trimGoVersion(%s) == '%s', but got '%s'", c.in, c.out, mv) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters