GoPLS Viewer

Home|gopls/internal/gocommand/version_test.go
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
5package gocommand
6
7import (
8    "strconv"
9    "testing"
10)
11
12func TestParseGoVersionOutput(t *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 itt := range tests {
25        t.Run(strconv.Itoa(i), func(t *testing.T) {
26            if got := parseGoVersionOutput([]byte(tt.args)); got != tt.want {
27                t.Errorf("parseGoVersionOutput() = %v, want %v"gottt.want)
28            }
29        })
30    }
31}
32
MembersX
TestParseGoVersionOutput
TestParseGoVersionOutput.t
TestParseGoVersionOutput.tests
TestParseGoVersionOutput.RangeStmt_738.i
TestParseGoVersionOutput.RangeStmt_738.tt
TestParseGoVersionOutput.RangeStmt_738.BlockStmt.BlockStmt.got
Members
X