summaryrefslogtreecommitdiff
path: root/internal/lsp/codegen_helpers_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-04 14:24:36 +0300
committerPaul Buetow <paul@buetow.org>2025-09-04 14:24:36 +0300
commitd68e5b3b188585fe234d0ce295ec7f054c8bad5f (patch)
tree974e067d9894f0da38513acdc27b56729b0f06e4 /internal/lsp/codegen_helpers_test.go
parent3c322b7046669a77c276ce05469bfc2db0b446b2 (diff)
tests(lsp): push coverage over 80%\n- Add init/trigger, chat history, document handler, transport readMessage, and rewrite resolve tests\n- Cover deferShowDocument and shutdown reply\n- Now ~81.2% coverage for internal/lsp
Diffstat (limited to 'internal/lsp/codegen_helpers_test.go')
-rw-r--r--internal/lsp/codegen_helpers_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/lsp/codegen_helpers_test.go b/internal/lsp/codegen_helpers_test.go
new file mode 100644
index 0000000..d897953
--- /dev/null
+++ b/internal/lsp/codegen_helpers_test.go
@@ -0,0 +1,15 @@
+package lsp
+
+import "testing"
+
+func TestParseGoPackageName(t *testing.T) {
+ lines := []string{"// comment", "package mypkg // trailing"}
+ if got := parseGoPackageName(lines); got != "mypkg" { t.Fatalf("got %q", got) }
+ if got := parseGoPackageName([]string{"no package"}); got != "" { t.Fatalf("expected empty") }
+}
+
+func TestDeriveGoFuncName(t *testing.T) {
+ if got := deriveGoFuncName("func Sum(a int) int { return a }"); got != "Sum" { t.Fatalf("got %q", got) }
+ if got := deriveGoFuncName("func (t *Type) Method(x int) {}"); got != "Method" { t.Fatalf("got %q", got) }
+}
+