mirror of
https://github.com/golang/go
synced 2024-11-18 13:04:46 -07:00
internal/lsp/regtest: cosmetic fixes
Add issue comments to tests for issues, move a couple constants closer to their use. Change-Id: I34fa2643195ae81e463a070952a1a1a4af2c6132 Reviewed-on: https://go-review.googlesource.com/c/tools/+/230997 Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
b8428586f4
commit
290e0af1a2
@ -147,6 +147,7 @@ const a = 3`)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests golang/go#37978.
|
||||||
func TestIssue37978(t *testing.T) {
|
func TestIssue37978(t *testing.T) {
|
||||||
runner.Run(t, exampleProgram, func(t *testing.T, env *Env) {
|
runner.Run(t, exampleProgram, func(t *testing.T, env *Env) {
|
||||||
// Create a new workspace-level directory and empty file.
|
// Create a new workspace-level directory and empty file.
|
||||||
@ -171,7 +172,10 @@ const a = http.MethodGet
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const noMod = `
|
// TestNoMod confirms that gopls continues to work when a user adds a go.mod
|
||||||
|
// file to their workspace.
|
||||||
|
func TestNoMod(t *testing.T) {
|
||||||
|
const noMod = `
|
||||||
-- main.go --
|
-- main.go --
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@ -188,9 +192,6 @@ func Hello() {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
// TestNoMod confirms that gopls continues to work when a user adds a go.mod
|
|
||||||
// file to their workspace.
|
|
||||||
func TestNoMod(t *testing.T) {
|
|
||||||
t.Run("manual", func(t *testing.T) {
|
t.Run("manual", func(t *testing.T) {
|
||||||
runner.Run(t, noMod, func(t *testing.T, env *Env) {
|
runner.Run(t, noMod, func(t *testing.T, env *Env) {
|
||||||
env.Await(
|
env.Await(
|
||||||
@ -223,7 +224,9 @@ func TestNoMod(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const testPackage = `
|
// Tests golang/go#38267.
|
||||||
|
func TestIssue38267(t *testing.T) {
|
||||||
|
const testPackage = `
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module mod.com
|
module mod.com
|
||||||
|
|
||||||
@ -254,7 +257,6 @@ func TestHello(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
func TestIssue38267(t *testing.T) {
|
|
||||||
runner.Run(t, testPackage, func(t *testing.T, env *Env) {
|
runner.Run(t, testPackage, func(t *testing.T, env *Env) {
|
||||||
env.OpenFile("lib_test.go")
|
env.OpenFile("lib_test.go")
|
||||||
env.Await(
|
env.Await(
|
||||||
@ -270,15 +272,15 @@ func TestIssue38267(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const packageChange = `
|
// Tests golang/go#38328.
|
||||||
|
func TestPackageChange_Issue38328(t *testing.T) {
|
||||||
|
const packageChange = `
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module fake
|
module fake
|
||||||
-- a.go --
|
-- a.go --
|
||||||
package foo
|
package foo
|
||||||
func main() {}
|
func main() {}
|
||||||
`
|
`
|
||||||
|
|
||||||
func TestPackageChange_Issue38328(t *testing.T) {
|
|
||||||
runner.Run(t, packageChange, func(t *testing.T, env *Env) {
|
runner.Run(t, packageChange, func(t *testing.T, env *Env) {
|
||||||
env.OpenFile("a.go")
|
env.OpenFile("a.go")
|
||||||
env.RegexpReplace("a.go", "foo", "foox")
|
env.RegexpReplace("a.go", "foo", "foox")
|
||||||
@ -345,6 +347,7 @@ func TestMissingDependency(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests golang/go#36951.
|
||||||
func TestAdHocPackages_Issue36951(t *testing.T) {
|
func TestAdHocPackages_Issue36951(t *testing.T) {
|
||||||
const adHoc = `
|
const adHoc = `
|
||||||
-- b/b.go --
|
-- b/b.go --
|
||||||
@ -360,6 +363,7 @@ func Hello() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests golang/go#37984.
|
||||||
func TestNoGOPATH_Issue37984(t *testing.T) {
|
func TestNoGOPATH_Issue37984(t *testing.T) {
|
||||||
const missingImport = `
|
const missingImport = `
|
||||||
-- main.go --
|
-- main.go --
|
||||||
@ -378,6 +382,7 @@ func _() {
|
|||||||
}, WithEnv("GOPATH="))
|
}, WithEnv("GOPATH="))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests golang/go#38669.
|
||||||
func TestEqualInEnv_Issue38669(t *testing.T) {
|
func TestEqualInEnv_Issue38669(t *testing.T) {
|
||||||
const missingImport = `
|
const missingImport = `
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
|
Loading…
Reference in New Issue
Block a user