| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package modfile |
| 6 |
|
| 7 |
import ( |
| 8 |
"testing" |
| 9 |
|
| 10 |
. "golang.org/x/tools/gopls/internal/test/integration" |
| 11 |
) |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
func TestTempModfileUnchanged(t *testing.T) { |
| 18 |
|
| 19 |
const badMod = ` |
| 20 |
-- go.mod -- |
| 21 |
module badmod.test/p |
| 22 |
-- p.go -- |
| 23 |
package p |
| 24 |
` |
| 25 |
|
| 26 |
WithOptions( |
| 27 |
Modes(Default), |
| 28 |
ProxyFiles(workspaceProxy), |
| 29 |
Settings{ |
| 30 |
"tempModfile": true, |
| 31 |
}, |
| 32 |
).Run(t, badMod, func(t *testing.T, env *Env) { |
| 33 |
env.OpenFile("p.go") |
| 34 |
env.AfterChange() |
| 35 |
want := "module badmod.test/p\n" |
| 36 |
got := env.ReadWorkspaceFile("go.mod") |
| 37 |
if got != want { |
| 38 |
t.Errorf("go.mod content:\n%s\nwant:\n%s", got, want) |
| 39 |
} |
| 40 |
}) |
| 41 |
} |