From bf53cf2a673af254d7a08bc3b2ab815a08f66117 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 4 Sep 2025 16:04:58 +0300 Subject: tests: add shared test fixtures, expand provider breadth (multi-choice, error bodies), add LSP rewrite/diagnostics realism and table-driven tests --- internal/lsp/instruction_table_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/lsp/instruction_table_test.go (limited to 'internal/lsp/instruction_table_test.go') diff --git a/internal/lsp/instruction_table_test.go b/internal/lsp/instruction_table_test.go new file mode 100644 index 0000000..e92ffde --- /dev/null +++ b/internal/lsp/instruction_table_test.go @@ -0,0 +1,25 @@ +package lsp + +import "testing" + +func TestFindFirstInstructionInLine_Table(t *testing.T) { + cases := []struct{ + name string + line string + instr string + }{ + {"strict_semicolon", ";do; trailing", "do"}, + {"c_block", "x /* add docs */ y", "add docs"}, + {"html_comment", " code", "fix"}, + {"slash_slash", "code // please refactor", "please refactor"}, + {"hash", "# summarize", "summarize"}, + {"double_dash", "-- rewrite quickly", "rewrite quickly"}, + } + for _, c := range cases { + instr, _, ok := findFirstInstructionInLine(c.line) + if !ok || instr != c.instr { + t.Fatalf("%s: got %q ok=%v", c.name, instr, ok) + } + } +} + -- cgit v1.2.3