@@ -13,31 +13,32 @@ import (
13
13
14
14
func TestVersionMessage (t * testing.T ) {
15
15
tests := []struct {
16
- goVer int
16
+ goVersion int
17
17
wantContains []string // string fragments that we expect to see
18
18
wantType protocol.MessageType
19
19
}{
20
+ {- 1 , nil , 0 },
20
21
{12 , []string {"1.12" , "not supported" , "upgrade to Go 1.16" , "install gopls v0.7.5" }, protocol .Error },
21
22
{13 , []string {"1.13" , "will be unsupported by gopls v0.11.0" , "upgrade to Go 1.16" , "install gopls v0.9.5" }, protocol .Warning },
22
23
{15 , []string {"1.15" , "will be unsupported by gopls v0.11.0" , "upgrade to Go 1.16" , "install gopls v0.9.5" }, protocol .Warning },
23
24
{16 , nil , 0 },
24
25
}
25
26
26
27
for _ , test := range tests {
27
- gotMsg , gotType := versionMessage (test .goVer )
28
+ gotMsg , gotType := versionMessage (test .goVersion )
28
29
29
30
if len (test .wantContains ) == 0 && gotMsg != "" {
30
- t .Errorf ("versionMessage(%d) = %q, want \" \" " , test .goVer , gotMsg )
31
+ t .Errorf ("versionMessage(%d) = %q, want \" \" " , test .goVersion , gotMsg )
31
32
}
32
33
33
34
for _ , want := range test .wantContains {
34
35
if ! strings .Contains (gotMsg , want ) {
35
- t .Errorf ("versionMessage(%d) = %q, want containing %q" , test .goVer , gotMsg , want )
36
+ t .Errorf ("versionMessage(%d) = %q, want containing %q" , test .goVersion , gotMsg , want )
36
37
}
37
38
}
38
39
39
40
if gotType != test .wantType {
40
- t .Errorf ("versionMessage(%d) = returned message type %d, want %d" , test .goVer , gotType , test .wantType )
41
+ t .Errorf ("versionMessage(%d) = returned message type %d, want %d" , test .goVersion , gotType , test .wantType )
41
42
}
42
43
}
43
44
}
0 commit comments