Skip to content

Commit

Permalink
cuepls: first integration test
Browse files Browse the repository at this point in the history
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 <paul@myitcv.io>
Change-Id: I036c4a344dd1b1d339cf744db029c60789e547cb
  • Loading branch information
myitcv committed Feb 14, 2024
1 parent b359aab commit f140fa6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cmd/cuepls/internal/test/integration/base/base_test.go
Original file line number Diff line number Diff line change
@@ -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))
})
}

0 comments on commit f140fa6

Please sign in to comment.