From 181a537aa0f04f1c62f85a27c4775b2d07d6c92e Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Wed, 27 Dec 2023 14:23:55 +0000 Subject: [PATCH] cuepls: first integration test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Basic integration test to ensure that everything is plumbed together. Notice how this integration test actually opens a Go file. We haven't at this stage made changes to cuepls (formerly gopls) to know about CUE files. That follows in a later CL. This integration test confirms that we have a working end-to-end setup. Which then allows for more aggressive tidy up to take place. For now we do not run the integration test on Windows because it doesn't work. That is covered by https://cuelang.org/issue/2752. For #142 Signed-off-by: Paul Jolly Change-Id: I036c4a344dd1b1d339cf744db029c60789e547cb Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1174172 TryBot-Result: CUEcueckoo Unity-Result: CUE porcuepine Reviewed-by: Daniel Martí --- .../test/integration/base/base_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmd/cuepls/internal/test/integration/base/base_test.go diff --git a/cmd/cuepls/internal/test/integration/base/base_test.go b/cmd/cuepls/internal/test/integration/base/base_test.go new file mode 100644 index 00000000000..ac5415a3b20 --- /dev/null +++ b/cmd/cuepls/internal/test/integration/base/base_test.go @@ -0,0 +1,33 @@ +//go:build !windows + +package feature + +import ( + "testing" + + "cuelang.org/go/internal/golangorgx/gopls/hooks" + . "cuelang.org/go/internal/golangorgx/gopls/test/integration" + "github.com/go-quicktest/qt" +) + +func TestMain(m *testing.M) { + Main(m, hooks.Options) +} + +func TestFormatFile(t *testing.T) { + const files = ` +-- go.mod -- +module mod.com + +go 1.12 +-- foo.go -- + package foo +` + Run(t, files, func(t *testing.T, env *Env) { + env.OpenFile("foo.go") + env.FormatBuffer("foo.go") + got := env.BufferText("foo.go") + want := "package foo\n" + qt.Assert(t, qt.Equals(got, want)) + }) +}