MCPcopy Create free account
hub / github.com/github/gh-aw / TestFormatSectionHeader

Function TestFormatSectionHeader

pkg/console/console_formatting_test.go:287–330  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

285}
286
287func TestFormatSectionHeader(t *testing.T) {
288 tests := []struct {
289 name string
290 header string
291 expected string
292 }{
293 {
294 name: "simple header",
295 header: "Overview",
296 expected: "Overview",
297 },
298 {
299 name: "header with spaces",
300 header: "Key Findings",
301 expected: "Key Findings",
302 },
303 {
304 name: "empty header",
305 header: "",
306 expected: "",
307 },
308 {
309 name: "header with numbers",
310 header: "Section 1: Configuration",
311 expected: "Section 1: Configuration",
312 },
313 }
314
315 for _, tt := range tests {
316 t.Run(tt.name, func(t *testing.T) {
317 result := FormatSectionHeader(tt.header)
318
319 // Should contain the header text
320 if !strings.Contains(result, tt.expected) {
321 t.Errorf("FormatSectionHeader() = %v, should contain %v", result, tt.expected)
322 }
323
324 // Result should not be empty unless input was empty
325 if tt.header != "" && result == "" {
326 t.Errorf("FormatSectionHeader() returned empty string for non-empty input")
327 }
328 })
329 }
330}
331
332// Edge case tests for all formatting functions
333func TestFormattingFunctionsWithSpecialCharacters(t *testing.T) {

Callers

nothing calls this directly

Calls 3

FormatSectionHeaderFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected