Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201028153306-37f0764111ff / internal / lsp / cmd / serve_test.go
1 // Copyright 2020 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 cmd
6
7 import "testing"
8
9 func TestListenParsing(t *testing.T) {
10         tests := []struct {
11                 input, wantNetwork, wantAddr string
12         }{
13                 {"127.0.0.1:0", "tcp", "127.0.0.1:0"},
14                 {"unix;/tmp/sock", "unix", "/tmp/sock"},
15                 {"auto", "auto", ""},
16                 {"auto;foo", "auto", "foo"},
17         }
18
19         for _, test := range tests {
20                 gotNetwork, gotAddr := parseAddr(test.input)
21                 if gotNetwork != test.wantNetwork {
22                         t.Errorf("network = %q, want %q", gotNetwork, test.wantNetwork)
23                 }
24                 if gotAddr != test.wantAddr {
25                         t.Errorf("addr = %q, want %q", gotAddr, test.wantAddr)
26                 }
27         }
28 }