summaryrefslogtreecommitdiff
path: root/internal/lsp/document_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/document_test.go')
-rw-r--r--internal/lsp/document_test.go42
1 files changed, 22 insertions, 20 deletions
diff --git a/internal/lsp/document_test.go b/internal/lsp/document_test.go
index 5fee18b..00e4548 100644
--- a/internal/lsp/document_test.go
+++ b/internal/lsp/document_test.go
@@ -9,20 +9,20 @@ import (
)
func newTestServer() *Server {
- s := &Server{
- logger: log.New(io.Discard, "", 0),
- docs: make(map[string]*document),
- inlineOpen: ">",
- inlineClose: ">",
- chatSuffix: ">",
- chatPrefixes: []string{"?","!",":",";"},
- }
- // Keep package-level helpers in sync for tests using free functions
- inlineOpenChar = '>'
- inlineCloseChar = '>'
- chatSuffixChar = '>'
- chatPrefixSingles = []string{"?","!",":",";"}
- return s
+ s := &Server{
+ logger: log.New(io.Discard, "", 0),
+ docs: make(map[string]*document),
+ inlineOpen: ">",
+ inlineClose: ">",
+ chatSuffix: ">",
+ chatPrefixes: []string{"?", "!", ":", ";"},
+ }
+ // Keep package-level helpers in sync for tests using free functions
+ inlineOpenChar = '>'
+ inlineCloseChar = '>'
+ chatSuffixChar = '>'
+ chatPrefixSingles = []string{"?", "!", ":", ";"}
+ return s
}
func TestSplitLines(t *testing.T) {
@@ -71,12 +71,14 @@ func TestLineContext_EmptyDoc(t *testing.T) {
}
func TestDocBeforeAfter_ClampsIndices(t *testing.T) {
- s := newTestServer()
- uri := "file:///clamp.go"
- s.setDocument(uri, "abc\nxyz")
- // Position beyond document length should be clamped safely
- before, after := s.docBeforeAfter(uri, Position{Line: 99, Character: 99})
- if before == "" && after == "" { t.Fatalf("expected some text with clamped indices") }
+ s := newTestServer()
+ uri := "file:///clamp.go"
+ s.setDocument(uri, "abc\nxyz")
+ // Position beyond document length should be clamped safely
+ before, after := s.docBeforeAfter(uri, Position{Line: 99, Character: 99})
+ if before == "" && after == "" {
+ t.Fatalf("expected some text with clamped indices")
+ }
}
func TestTrimLen(t *testing.T) {