aboutsummaryrefslogtreecommitdiff
path: root/internal/stdlib/stdlib_test.go
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2023-07-12 14:25:19 -0400
committerRobert Findley <rfindley@google.com>2023-07-12 19:51:17 +0000
commit8cc68fd9b58be65b191809d99fd444c44233fffa (patch)
tree57a039f0bc1e99fffd754f56077c9f724307b937 /internal/stdlib/stdlib_test.go
parentf36927e488132f6f557327e5dd83ea462dfed99d (diff)
downloadgo-x-pkgsite-8cc68fd9b58be65b191809d99fd444c44233fffa.tar.xz
internal/stdlib: update to account for .0 major version suffixes
Starting with go1.21.0, the first version of new major Go versions will include the .0 suffix (compare go1.20). Update pkgsite logic to account for this switch, and add unit+integration test support. Fixes golang/go#60373 Change-Id: Ibdac8a3413a48f925427a5aae366bed2f691cfa6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/508937 Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/stdlib/stdlib_test.go')
-rw-r--r--internal/stdlib/stdlib_test.go29
1 files changed, 26 insertions, 3 deletions
diff --git a/internal/stdlib/stdlib_test.go b/internal/stdlib/stdlib_test.go
index 8841b0a8..7425150e 100644
--- a/internal/stdlib/stdlib_test.go
+++ b/internal/stdlib/stdlib_test.go
@@ -64,6 +64,26 @@ func TestTagForVersion(t *testing.T) {
want: "go1.13",
},
{
+ name: "version v1.20.0-rc.2",
+ version: "v1.20.0-rc.2",
+ want: "go1.20rc2",
+ },
+ {
+ name: "version v1.20.0",
+ version: "v1.20.0",
+ want: "go1.20",
+ },
+ {
+ name: "version v1.21.0-rc.2",
+ version: "v1.21.0-rc.2",
+ want: "go1.21rc2",
+ },
+ {
+ name: "version v1.21.0",
+ version: "v1.21.0",
+ want: "go1.21.0",
+ },
+ {
name: "master branch",
version: "master",
want: "master",
@@ -96,7 +116,7 @@ func TestTagForVersion(t *testing.T) {
return
}
if got != test.want {
- t.Errorf("TagForVersion(%q) = %q, %v, wanted %q, %v", test.version, got, err, test.want, nil)
+ t.Fatalf("TagForVersion(%q) = %q, %v, wanted %q, %v", test.version, got, err, test.want, nil)
}
})
}
@@ -236,7 +256,7 @@ func TestZipInfo(t *testing.T) {
}{
{
requestedVersion: "latest",
- want: "v1.14.6",
+ want: "v1.21.0",
},
{
requestedVersion: "master",
@@ -279,7 +299,8 @@ func TestVersions(t *testing.T) {
otherWants := append([]string{"v1.17.6"}, commonWants...)
t.Run("test", func(t *testing.T) {
defer WithTestData()()
- testVersions(commonWants)
+ testWants := append([]string{"v1.21.0"}, commonWants...)
+ testVersions(testWants)
})
t.Run("local", func(t *testing.T) {
if *repoPath == "" {
@@ -316,6 +337,8 @@ func TestVersionForTag(t *testing.T) {
{"go1.0", ""},
{"weekly.2012-02-14", ""},
{"latest", "latest"},
+ {"go1.21.0", "v1.21.0"},
+ {"go1.21", "v1.21.0"},
} {
got := VersionForTag(test.in)
if got != test.want {