diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-06 13:19:01 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-06 13:19:01 +0300 |
| commit | 04f290dbeeee8a6fcbc70fed253a968336bcb2ab (patch) | |
| tree | 3ee23a4ac4bcc5b43b43697cfb0e905735fc6331 /internal/lsp/codeaction_gotest_int_test.go | |
| parent | 5e966f50111adf6e2cb2683fe588f6fe033fa931 (diff) | |
more tests
Diffstat (limited to 'internal/lsp/codeaction_gotest_int_test.go')
| -rw-r--r-- | internal/lsp/codeaction_gotest_int_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
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) + } +} + |
