diff options
Diffstat (limited to 'internal/lsp/instruction_table_test.go')
| -rw-r--r-- | internal/lsp/instruction_table_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
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", "<!-- fix --> 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) + } + } +} + |
