...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package version
16
17 import "testing"
18
19 func TestGoVer(t *testing.T) {
20 for _, tst := range []struct {
21 in, want string
22 }{
23 {"go1.8", "1.8.0"},
24 {"go1.7.3", "1.7.3"},
25 {"go1.8.typealias", "1.8.0-typealias"},
26 {"go1.8beta1", "1.8.0-beta1"},
27 {"go1.8rc2", "1.8.0-rc2"},
28 {"devel +824f981dd4b7 Tue Apr 29 21:41:54 2014 -0400", "824f981dd4b7"},
29 {"foo bar zipzap", ""},
30 } {
31 if got := goVer(tst.in); got != tst.want {
32 t.Errorf("goVer(%q) = %q, want %q", tst.in, got, tst.want)
33 }
34 }
35 }
36
View as plain text