(t *testing.T)
| 273 | } |
| 274 | |
| 275 | func TestExtractCodeBlock(t *testing.T) { |
| 276 | tests := []struct { |
| 277 | name string |
| 278 | input string |
| 279 | want string |
| 280 | }{ |
| 281 | {"with language tag", "```go\nfoo\nbar\n```", "foo\nbar"}, |
| 282 | {"without language tag", "```\nfoo\n```", "foo"}, |
| 283 | {"with surrounding text", "Here:\n```\ncode\n```\ndone", "code"}, |
| 284 | {"no code block", "just text", ""}, |
| 285 | {"empty block", "```\n```", ""}, |
| 286 | {"opening fence without newline", "```go", ""}, |
| 287 | {"no closing fence", "```\nfoo\nbar", ""}, |
| 288 | } |
| 289 | for _, tt := range tests { |
| 290 | t.Run(tt.name, func(t *testing.T) { |
| 291 | got := extractCodeBlock(tt.input) |
| 292 | if got != tt.want { |
| 293 | t.Errorf("extractCodeBlock() = %q, want %q", got, tt.want) |
| 294 | } |
| 295 | }) |
| 296 | } |
| 297 | } |
nothing calls this directly
no test coverage detected