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