summaryrefslogtreecommitdiff
path: root/internal/lsp/handlers_helpers_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/handlers_helpers_test.go')
-rw-r--r--internal/lsp/handlers_helpers_test.go56
1 files changed, 28 insertions, 28 deletions
diff --git a/internal/lsp/handlers_helpers_test.go b/internal/lsp/handlers_helpers_test.go
index 24a9690..0120cc3 100644
--- a/internal/lsp/handlers_helpers_test.go
+++ b/internal/lsp/handlers_helpers_test.go
@@ -6,32 +6,32 @@ import (
)
func TestHasDoubleSemicolonTrigger(t *testing.T) {
- cases := []struct {
- line string
- want bool
- }{
- {">>todo> remove this", true},
- {"prefix >>x> suffix", true},
- {">> spaced >", false},
- {"no markers", false},
- {">>x > space before close", false},
- }
- for _, tc := range cases {
- got := hasDoubleOpenTrigger(tc.line)
- if got != tc.want {
- t.Fatalf("hasDoubleOpenTrigger(%q)=%v want %v", tc.line, got, tc.want)
- }
- }
+ cases := []struct {
+ line string
+ want bool
+ }{
+ {">>todo> remove this", true},
+ {"prefix >>x> suffix", true},
+ {">> spaced >", false},
+ {"no markers", false},
+ {">>x > space before close", false},
+ }
+ for _, tc := range cases {
+ got := hasDoubleOpenTrigger(tc.line)
+ if got != tc.want {
+ t.Fatalf("hasDoubleOpenTrigger(%q)=%v want %v", tc.line, got, tc.want)
+ }
+ }
}
func TestCollectSemicolonMarkers(t *testing.T) {
- line := "keep >ok> this and >another> that"
- edits := collectSemicolonMarkers(line, 7)
- if len(edits) != 2 {
- t.Fatalf("expected 2 edits, got %d", len(edits))
- }
- // Validate the first edit aligns with ;ok;
- start := strings.Index(line, ">ok>")
+ line := "keep >ok> this and >another> that"
+ edits := collectSemicolonMarkers(line, 7)
+ if len(edits) != 2 {
+ t.Fatalf("expected 2 edits, got %d", len(edits))
+ }
+ // Validate the first edit aligns with ;ok;
+ start := strings.Index(line, ">ok>")
if start < 0 {
t.Fatalf("test setup: missing ;ok;")
}
@@ -41,11 +41,11 @@ func TestCollectSemicolonMarkers(t *testing.T) {
}
func TestPromptRemovalEditsForLine_WholeLine(t *testing.T) {
- line := ">>todo> remove this whole line"
- edits := promptRemovalEditsForLine(line, 3)
- if len(edits) != 1 {
- t.Fatalf("expected 1 whole-line edit, got %d", len(edits))
- }
+ line := ">>todo> remove this whole line"
+ edits := promptRemovalEditsForLine(line, 3)
+ if len(edits) != 1 {
+ t.Fatalf("expected 1 whole-line edit, got %d", len(edits))
+ }
e := edits[0]
if e.Range.Start.Line != 3 || e.Range.End.Line != 3 || e.Range.Start.Character != 0 || e.Range.End.Character != len(line) {
t.Fatalf("unexpected range for whole-line removal: %+v", e.Range)