blob: d897953c467327bc750018e066d00b72b7422c3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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) }
}
|