Skip to content

Commit 9b60852

Browse files
committed
gopls/internal/regtest: move TestMultipleModules_Warning to ./workspace
This test is really about workspace setup, not diagnostics. Move it in advance of changes to this feature. Pure code move, no other changes. Change-Id: Ib78f1fe5ce701673f5aa071f399da11f208874df Reviewed-on: https://go-review.googlesource.com/c/tools/+/421498 Reviewed-by: Suzy Mueller <[email protected]>
1 parent 06d96ee commit 9b60852

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

gopls/internal/regtest/diagnostics/diagnostics_test.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,57 +1692,6 @@ import (
16921692
})
16931693
}
16941694

1695-
func TestMultipleModules_Warning(t *testing.T) {
1696-
const modules = `
1697-
-- a/go.mod --
1698-
module a.com
1699-
1700-
go 1.12
1701-
-- a/a.go --
1702-
package a
1703-
-- b/go.mod --
1704-
module b.com
1705-
1706-
go 1.12
1707-
-- b/b.go --
1708-
package b
1709-
`
1710-
for _, go111module := range []string{"on", "auto"} {
1711-
t.Run("GO111MODULE="+go111module, func(t *testing.T) {
1712-
WithOptions(
1713-
Modes(Default),
1714-
EnvVars{"GO111MODULE": go111module},
1715-
).Run(t, modules, func(t *testing.T, env *Env) {
1716-
env.OpenFile("a/a.go")
1717-
env.OpenFile("b/go.mod")
1718-
env.Await(
1719-
env.DiagnosticAtRegexp("a/a.go", "package a"),
1720-
env.DiagnosticAtRegexp("b/go.mod", "module b.com"),
1721-
OutstandingWork(lsp.WorkspaceLoadFailure, "gopls requires a module at the root of your workspace."),
1722-
)
1723-
})
1724-
})
1725-
}
1726-
1727-
// Expect no warning if GO111MODULE=auto in a directory in GOPATH.
1728-
t.Run("GOPATH_GO111MODULE_auto", func(t *testing.T) {
1729-
WithOptions(
1730-
Modes(Default),
1731-
EnvVars{"GO111MODULE": "auto"},
1732-
InGOPATH(),
1733-
).Run(t, modules, func(t *testing.T, env *Env) {
1734-
env.OpenFile("a/a.go")
1735-
env.Await(
1736-
OnceMet(
1737-
env.DoneWithOpen(),
1738-
EmptyDiagnostics("a/a.go"),
1739-
),
1740-
NoOutstandingWork(),
1741-
)
1742-
})
1743-
})
1744-
}
1745-
17461695
func TestNestedModules(t *testing.T) {
17471696
const proxy = `
17481697
-- [email protected]/go.mod --

gopls/internal/regtest/workspace/broken_test.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,54 @@ const F = named.D - 3
167167
env.Await(NoOutstandingDiagnostics())
168168
})
169169
}
170+
171+
func TestMultipleModules_Warning(t *testing.T) {
172+
const modules = `
173+
-- a/go.mod --
174+
module a.com
175+
176+
go 1.12
177+
-- a/a.go --
178+
package a
179+
-- b/go.mod --
180+
module b.com
181+
182+
go 1.12
183+
-- b/b.go --
184+
package b
185+
`
186+
for _, go111module := range []string{"on", "auto"} {
187+
t.Run("GO111MODULE="+go111module, func(t *testing.T) {
188+
WithOptions(
189+
Modes(Default),
190+
EnvVars{"GO111MODULE": go111module},
191+
).Run(t, modules, func(t *testing.T, env *Env) {
192+
env.OpenFile("a/a.go")
193+
env.OpenFile("b/go.mod")
194+
env.Await(
195+
env.DiagnosticAtRegexp("a/a.go", "package a"),
196+
env.DiagnosticAtRegexp("b/go.mod", "module b.com"),
197+
OutstandingWork(lsp.WorkspaceLoadFailure, "gopls requires a module at the root of your workspace."),
198+
)
199+
})
200+
})
201+
}
202+
203+
// Expect no warning if GO111MODULE=auto in a directory in GOPATH.
204+
t.Run("GOPATH_GO111MODULE_auto", func(t *testing.T) {
205+
WithOptions(
206+
Modes(Default),
207+
EnvVars{"GO111MODULE": "auto"},
208+
InGOPATH(),
209+
).Run(t, modules, func(t *testing.T, env *Env) {
210+
env.OpenFile("a/a.go")
211+
env.Await(
212+
OnceMet(
213+
env.DoneWithOpen(),
214+
EmptyDiagnostics("a/a.go"),
215+
),
216+
NoOutstandingWork(),
217+
)
218+
})
219+
})
220+
}

0 commit comments

Comments
 (0)