-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/installtools: install [email protected] for go < 1.17
Updates #2162 Change-Id: I5adc4ca6d7b0f8a8e3df7e1f403917fc94ef7b23 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/400362 Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
- Loading branch information
Showing
2 changed files
with
95 additions
and
30 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Binary installtools is a helper that installs Go tools extension tests depend on. | ||
package main | ||
|
||
import "testing" | ||
|
||
func Test_pickVersion(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
versions []finalVersion | ||
want map[int]string | ||
}{ | ||
{ | ||
name: "nil", | ||
versions: nil, | ||
want: map[int]string{15: "latest", 16: "latest", 17: "latest", 18: "latest"}, | ||
}, | ||
{ | ||
name: "one_entry", | ||
versions: []finalVersion{ | ||
{16, "v0.2.2"}, | ||
}, | ||
want: map[int]string{15: "v0.2.2", 16: "v0.2.2", 17: "latest", 18: "latest"}, | ||
}, | ||
{ | ||
name: "two_entries", | ||
versions: []finalVersion{ | ||
{16, "v0.2.2"}, | ||
{17, "v0.3.0"}, | ||
}, | ||
want: map[int]string{15: "v0.2.2", 16: "v0.2.2", 17: "v0.3.0", 18: "latest"}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
for goMinorVersion, want := range tt.want { | ||
if got := pickVersion(goMinorVersion, tt.versions); got != want { | ||
t.Errorf("pickVersion(go 1.%v) = %v, want %v", goMinorVersion, got, want) | ||
} | ||
} | ||
}) | ||
} | ||
} |