From 04f290dbeeee8a6fcbc70fed253a968336bcb2ab Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Sep 2025 13:19:01 +0300 Subject: more tests --- internal/lsp/codeaction_gotest_int_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 internal/lsp/codeaction_gotest_int_test.go (limited to 'internal/lsp/codeaction_gotest_int_test.go') diff --git a/internal/lsp/codeaction_gotest_int_test.go b/internal/lsp/codeaction_gotest_int_test.go new file mode 100644 index 0000000..6bb1c45 --- /dev/null +++ b/internal/lsp/codeaction_gotest_int_test.go @@ -0,0 +1,26 @@ +package lsp + +import ( + "os" + "path/filepath" + "testing" +) + +func TestResolveGoTest_CreatesTestFile(t *testing.T) { + dir := t.TempDir() + src := filepath.Join(dir, "x.go") + if err := os.WriteFile(src, []byte("package x\n\nfunc Sum(a,b int) int { return a+b }\n"), 0o644); err != nil { + t.Fatalf("write: %v", err) + } + s := &Server{} // minimal server with nil llmClient to trigger stub + uri := "file://" + src + we, jumpURI, jumpRange, ok := s.resolveGoTest(uri, Position{Line: 2}) + if !ok || jumpURI == "" || jumpRange.Start.Line < 0 { + t.Fatalf("resolveGoTest failed: ok=%v uri=%q range=%v", ok, jumpURI, jumpRange) + } + // Expect documentChanges to include a create and an edit + if len(we.DocumentChanges) == 0 && len(we.Changes) == 0 { + t.Fatalf("expected edits to create or append test file: %+v", we) + } +} + -- cgit v1.2.3