1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package lsp
import "testing"
func TestFindFirstInstructionInLine_Table(t *testing.T) {
cases := []struct {
name string
line string
instr string
}{
{"strict_inline_marker", ">!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 {
s := newTestServer()
instr, _, ok := s.findFirstInstructionInLine(c.line)
if !ok || instr != c.instr {
t.Fatalf("%s: got %q ok=%v", c.name, instr, ok)
}
}
}
|