(t *testing.T)
| 196 | } |
| 197 | |
| 198 | func TestExtractCodeBlock(t *testing.T) { |
| 199 | tests := []struct { |
| 200 | name string |
| 201 | input string |
| 202 | want string |
| 203 | }{ |
| 204 | {"with language tag", "```go\nfoo\nbar\n```", "foo\nbar"}, |
| 205 | {"without language tag", "```\nfoo\n```", "foo"}, |
| 206 | {"with surrounding text", "Here:\n```\ncode\n```\ndone", "code"}, |
| 207 | {"no code block", "just text", ""}, |
| 208 | {"empty block", "```\n```", ""}, |
| 209 | {"opening fence without newline", "```go", ""}, |
| 210 | {"no closing fence", "```\nfoo\nbar", ""}, |
| 211 | } |
| 212 | for _, tt := range tests { |
| 213 | t.Run(tt.name, func(t *testing.T) { |
| 214 | got := extractCodeBlock(tt.input) |
| 215 | if got != tt.want { |
| 216 | t.Errorf("extractCodeBlock() = %q, want %q", got, tt.want) |
| 217 | } |
| 218 | }) |
| 219 | } |
| 220 | } |
nothing calls this directly
no test coverage detected