summaryrefslogtreecommitdiff
path: root/internal/lsp/code_fences_table_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/code_fences_table_test.go')
-rw-r--r--internal/lsp/code_fences_table_test.go45
1 files changed, 22 insertions, 23 deletions
diff --git a/internal/lsp/code_fences_table_test.go b/internal/lsp/code_fences_table_test.go
index c217bce..340ed61 100644
--- a/internal/lsp/code_fences_table_test.go
+++ b/internal/lsp/code_fences_table_test.go
@@ -3,30 +3,29 @@ package lsp
import "testing"
func TestStripCodeFences_Table(t *testing.T) {
- cases := []struct{ name, in, want string }{
- {"no_fence", "return x", "return x"},
- {"plain_fence", "```\nA\nB\n```", "A\nB"},
- {"lang_fence", "```go\nfmt.Println()\n```", "fmt.Println()"},
- {"spaces", " \n```python\nprint('x')\n```\n ", "print('x')"},
- }
- for _, c := range cases {
- if got := stripCodeFences(c.in); got != c.want {
- t.Fatalf("%s: got %q want %q", c.name, got, c.want)
- }
- }
+ cases := []struct{ name, in, want string }{
+ {"no_fence", "return x", "return x"},
+ {"plain_fence", "```\nA\nB\n```", "A\nB"},
+ {"lang_fence", "```go\nfmt.Println()\n```", "fmt.Println()"},
+ {"spaces", " \n```python\nprint('x')\n```\n ", "print('x')"},
+ }
+ for _, c := range cases {
+ if got := stripCodeFences(c.in); got != c.want {
+ t.Fatalf("%s: got %q want %q", c.name, got, c.want)
+ }
+ }
}
func TestStripInlineCodeSpan_Table(t *testing.T) {
- cases := []struct{ name, in, want string }{
- {"no_ticks", "text", "text"},
- {"single_span", "Use `foo()` here", "foo()"},
- {"multiple", "`a` + `b`", "a"},
- {"unmatched", "`missing end", "`missing end"},
- }
- for _, c := range cases {
- if got := stripInlineCodeSpan(c.in); got != c.want {
- t.Fatalf("%s: got %q want %q", c.name, got, c.want)
- }
- }
+ cases := []struct{ name, in, want string }{
+ {"no_ticks", "text", "text"},
+ {"single_span", "Use `foo()` here", "foo()"},
+ {"multiple", "`a` + `b`", "a"},
+ {"unmatched", "`missing end", "`missing end"},
+ }
+ for _, c := range cases {
+ if got := stripInlineCodeSpan(c.in); got != c.want {
+ t.Fatalf("%s: got %q want %q", c.name, got, c.want)
+ }
+ }
}
-