Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.5.2 / internal / regtest / configuration_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 regtest
6
7 import (
8         "testing"
9
10         "golang.org/x/tools/internal/lsp"
11         "golang.org/x/tools/internal/lsp/fake"
12 )
13
14 // Test that enabling and disabling produces the expected results of showing
15 // and hiding staticcheck analysis results.
16 func TestChangeConfiguration(t *testing.T) {
17         const files = `
18 -- go.mod --
19 module mod.com
20
21 go 1.12
22 -- a/a.go --
23 package a
24
25 // NotThisVariable should really start with ThisVariable.
26 const ThisVariable = 7
27 `
28         run(t, files, func(t *testing.T, env *Env) {
29                 env.OpenFile("a/a.go")
30                 env.Await(
31                         CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1),
32                         NoDiagnostics("a/a.go"),
33                 )
34                 cfg := &fake.EditorConfig{}
35                 *cfg = env.Editor.Config
36                 cfg.EnableStaticcheck = true
37                 env.changeConfiguration(t, cfg)
38                 env.Await(
39                         DiagnosticAt("a/a.go", 2, 0),
40                 )
41         })
42 }