MCPcopy Create free account
hub / github.com/astercloud/aster / TestExtractSectionTitle

Function TestExtractSectionTitle

pkg/compression/service_test.go:289–310  ·  view source on GitHub ↗

TestExtractSectionTitle 测试提取段落标题

(t *testing.T)

Source from the content-addressed store, hash-verified

287
288// TestExtractSectionTitle 测试提取段落标题
289func 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 测试保留段落判断
313func TestShouldPreserve(t *testing.T) {

Callers

nothing calls this directly

Calls 2

extractSectionTitleMethod · 0.95

Tested by

no test coverage detected