TestExtractSectionTitle 测试提取段落标题
(t *testing.T)
| 287 | |
| 288 | // TestExtractSectionTitle 测试提取段落标题 |
| 289 | func TestExtractSectionTitle(t *testing.T) { |
| 290 | svc := NewDefaultCompressionService(nil, 100) |
| 291 | |
| 292 | testCases := []struct { |
| 293 | section string |
| 294 | expected string |
| 295 | }{ |
| 296 | {"## Tools Manual\nContent", "Tools Manual"}, |
| 297 | {"### Sub Section\nContent", "Sub Section"}, |
| 298 | {"# Main Title\nContent", "Main Title"}, |
| 299 | {"No header here\nContent", ""}, |
| 300 | {"", ""}, |
| 301 | } |
| 302 | |
| 303 | for _, tc := range testCases { |
| 304 | result := svc.extractSectionTitle(tc.section) |
| 305 | if result != tc.expected { |
| 306 | t.Errorf("extractSectionTitle(%q) = %q, expected %q", |
| 307 | tc.section, result, tc.expected) |
| 308 | } |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | // TestShouldPreserve 测试保留段落判断 |
| 313 | func TestShouldPreserve(t *testing.T) { |
nothing calls this directly
no test coverage detected