@@ -36,45 +36,37 @@ func TestParseGoVersion(t *testing.T) {
36
36
37
37
func TestGetVersionToInstall (t * testing.T ) {
38
38
tests := map [versionInfo ]string {
39
- // checkForUnsupportedVersions()
40
-
41
- // go.mod version below minGoVersion
42
- {"0.0" , true , "1.20.3" , true }: "" ,
43
- {"0.0" , true , "9999.0" , true }: "" ,
44
- {"0.0" , true , "1.2.2" , true }: "" ,
45
- {"0.0" , true , "" , false }: "" ,
46
- // go.mod version above maxGoVersion
47
- {"9999.0" , true , "1.20.3" , true }: "" ,
48
- {"9999.0" , true , "9999.0.1" , true }: "" ,
49
- {"9999.0" , true , "1.1" , true }: "" ,
50
- {"9999.0" , true , "" , false }: "" ,
51
- // Go installation found with version below minGoVersion
52
- {"1.20" , true , "1.2.2" , true }: "1.20" ,
53
- {"1.11" , true , "1.2.2" , true }: "1.11" ,
39
+ // getVersionWhenGoModVersionNotFound()
40
+ {"" , false , "" , false }: maxGoVersion ,
54
41
{"" , false , "1.2.2" , true }: maxGoVersion ,
55
- // Go installation found with version above maxGoVersion
56
- {"1.20" , true , "9999.0.1" , true }: "1.20" ,
57
- {"1.11" , true , "9999.0.1" , true }: "1.11" ,
58
- {"" , false , "9999.0.1" , true }: maxGoVersion ,
42
+ {"" , false , "9999.0.1" , true }: maxGoVersion ,
43
+ {"" , false , "1.11.13" , true }: "" ,
44
+ {"" , false , "1.20.3" , true }: "" ,
59
45
60
- // checkForVersionsNotFound()
46
+ // getVersionWhenGoModVersionTooHigh()
47
+ {"9999.0" , true , "" , false }: maxGoVersion ,
48
+ {"9999.0" , true , "9999.0.1" , true }: "" ,
49
+ {"9999.0" , true , "1.1" , true }: maxGoVersion ,
50
+ {"9999.0" , true , minGoVersion , false }: maxGoVersion ,
51
+ {"9999.0" , true , maxGoVersion , true }: "" ,
61
52
62
- // Go installation not found, go.mod version in supported range
63
- {"1.20" , true , "" , false }: "1.20" ,
64
- {"1.11" , true , "" , false }: "1.11" ,
65
- // Go installation not found, go.mod not found
66
- {"" , false , "" , false }: maxGoVersion ,
67
- // Go installation found with version in supported range, go.mod not found
68
- {"" , false , "1.11.13" , true }: "" ,
69
- {"" , false , "1.20.3" , true }: "" ,
70
-
71
- // compareVersions()
53
+ // getVersionWhenGoModVersionTooLow()
54
+ {"0.0" , true , "" , false }: minGoVersion ,
55
+ {"0.0" , true , "9999.0" , true }: minGoVersion ,
56
+ {"0.0" , true , "1.2.2" , true }: minGoVersion ,
57
+ {"0.0" , true , "1.20.3" , true }: "" ,
72
58
73
- // Go installation found with version in supported range, go.mod version in supported range and go.mod version > go installation version
59
+ // getVersionWhenGoModVersionSupported()
60
+ {"1.20" , true , "" , false }: "1.20" ,
61
+ {"1.11" , true , "" , false }: "1.11" ,
62
+ {"1.20" , true , "1.2.2" , true }: "1.20" ,
63
+ {"1.11" , true , "1.2.2" , true }: "1.11" ,
64
+ {"1.20" , true , "9999.0.1" , true }: "1.20" ,
65
+ {"1.11" , true , "9999.0.1" , true }: "1.11" ,
66
+ // go.mod version > go installation version
74
67
{"1.20" , true , "1.11.13" , true }: "1.20" ,
75
68
{"1.20" , true , "1.12" , true }: "1.20" ,
76
- // Go installation found with version in supported range, go.mod version in supported range and go.mod version <= go installation version
77
- // (Note comparisons ignore the patch version)
69
+ // go.mod version <= go installation version (Note comparisons ignore the patch version)
78
70
{"1.11" , true , "1.20" , true }: "" ,
79
71
{"1.11" , true , "1.20.3" , true }: "" ,
80
72
{"1.20" , true , "1.20.3" , true }: "" ,
0 commit comments