| 1 | // Copyright 2022 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package gocommandscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/gocommand`/ |
| 6 | |
| 7 | import ( |
| 8 | "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 10 | ) |
| 11 | |
| 12 | func TestParseGoVersionOutputscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/gocommand`/TestParseGoVersionOutput().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 13 | tests := []struct { |
| 14 | args string |
| 15 | want string |
| 16 | }{ |
| 17 | {"go version go1.12 linux/amd64", "go1.12"}, |
| 18 | {"go version go1.18.1 darwin/amd64", "go1.18.1"}, |
| 19 | {"go version go1.19.rc1 windows/arm64", "go1.19.rc1"}, |
| 20 | {"go version devel d5de62df152baf4de6e9fe81933319b86fd95ae4 linux/386", "devel d5de62df152baf4de6e9fe81933319b86fd95ae4"}, |
| 21 | {"go version devel go1.20-1f068f0dc7 Tue Oct 18 20:58:37 2022 +0000 darwin/amd64", "devel go1.20-1f068f0dc7"}, |
| 22 | {"v1.19.1 foo/bar", ""}, |
| 23 | } |
| 24 | for i, tt := range tests { |
| 25 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Itoascip-go gomod github.com/golang/go/src go1.25.0 strconv/Itoa().(i), func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 26 | if got := ParseGoVersionOutputscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/gocommand`/ParseGoVersionOutput().(tt.args); got != tt.want { |
| 27 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("parseGoVersionOutput() = %v, want %v", got, tt.want) |
| 28 | } |
| 29 | }) |
| 30 | } |
| 31 | } |