mirror of
https://github.com/golang/oauth2.git
synced 2025-07-21 00:00:09 +08:00
For golang/oauth2#615 Change-Id: I1e17703f5a52240cbd7802ab1da1fd8b24be8d6c Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/666816 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Matt Hickford <matt.hickford@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
47 lines
827 B
Go
47 lines
827 B
Go
// Copyright 2023 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package externalaccount
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func TestGoVersion(t *testing.T) {
|
|
testVersion := func(v string) func() string {
|
|
return func() string {
|
|
return v
|
|
}
|
|
}
|
|
for _, tst := range []struct {
|
|
v func() string
|
|
want string
|
|
}{
|
|
{
|
|
testVersion("go1.19"),
|
|
"1.19.0",
|
|
},
|
|
{
|
|
testVersion("go1.21-20230317-RC01"),
|
|
"1.21.0-20230317-RC01",
|
|
},
|
|
{
|
|
testVersion("devel +abc1234"),
|
|
"abc1234",
|
|
},
|
|
{
|
|
testVersion("this should be unknown"),
|
|
versionUnknown,
|
|
},
|
|
} {
|
|
version = tst.v
|
|
got := goVersion()
|
|
if got != tst.want {
|
|
t.Errorf("go version = %q, want = %q", got, tst.want)
|
|
}
|
|
}
|
|
version = runtime.Version
|
|
}
|