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