(t *testing.T)
| 394 | } |
| 395 | |
| 396 | func TestBuildTitledBar_LeftAlignedWithEmojiFill(t *testing.T) { |
| 397 | fill := "📦" |
| 398 | hw := runewidth.StringWidth(fill) |
| 399 | title := "Box CLI Maker" |
| 400 | |
| 401 | left := fill |
| 402 | right := fill |
| 403 | leftW := hw |
| 404 | rightW := hw |
| 405 | lineWidth := hw*20 + leftW + rightW |
| 406 | |
| 407 | bar := buildTitledBar(left, fill, right, leftW, rightW, lineWidth, hw, title) |
| 408 | if w := runewidth.StringWidth(ansi.Strip(bar)); w != lineWidth { |
| 409 | t.Fatalf("expected bar visual width %d, got %d", lineWidth, w) |
| 410 | } |
| 411 | plain := ansi.Strip(bar) |
| 412 | if !strings.Contains(plain, " "+title+" ") { |
| 413 | t.Fatalf("expected bar to contain title with spaces, got %q", plain) |
| 414 | } |
| 415 | if !strings.HasPrefix(plain, fill+" ") { |
| 416 | t.Errorf("expected left corner followed by space then title, got %q", plain) |
| 417 | } |
| 418 | if !strings.HasSuffix(plain, fill) { |
| 419 | t.Errorf("expected bar to end with fill glyph, got %q", plain) |
| 420 | } |
| 421 | } |
nothing calls this directly
no test coverage detected