diff options
Diffstat (limited to 'internal/lsp/handlers_test.go')
| -rw-r--r-- | internal/lsp/handlers_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/lsp/handlers_test.go b/internal/lsp/handlers_test.go index 0b12611..1b5080a 100644 --- a/internal/lsp/handlers_test.go +++ b/internal/lsp/handlers_test.go @@ -238,3 +238,19 @@ func TestInstructionFromSelection_HTMLAndLineComments(t *testing.T) { t.Fatalf("cleaned should remove html comment markers") } } + +func TestStripDuplicateAssignmentPrefix(t *testing.T) { + prefix := "matrix := " + sug := "matrix := NewMatrix(2,2)" + got := stripDuplicateAssignmentPrefix(prefix, sug) + if got != "NewMatrix(2,2)" { + t.Fatalf("dup strip failed: got %q", got) + } + // '=' variant + prefix2 := "x = " + sug2 := "x = y + 1" + got2 := stripDuplicateAssignmentPrefix(prefix2, sug2) + if got2 != "y + 1" { + t.Fatalf("dup strip '=' failed: got %q", got2) + } +} |
