MCPcopy Index your code
hub / github.com/box-cli-maker/box-cli-maker / TestRenderBasicBox

Function TestRenderBasicBox

box_render_test.go:11–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestRenderBasicBox(t *testing.T) {
12 b := NewBox().Padding(2, 1).Style(Single)
13
14 out, err := b.Render("Box CLI Maker", "Highly Customizable Terminal Box Maker")
15 if err != nil {
16 t.Fatalf("Render returned error: %v", err)
17 }
18 if out == "" {
19 t.Fatalf("expected non-empty render output")
20 }
21
22 if !strings.Contains(out, "Box CLI Maker") || !strings.Contains(out, "Highly Customizable Terminal Box Maker") {
23 t.Fatalf("rendered output does not contain title/content: %q", out)
24 }
25
26 // Basic structural checks: top and bottom lines should use the Single style corners.
27 lines := strings.Split(out, "\n")
28 if len(lines) < 3 {
29 t.Fatalf("expected at least 3 lines in rendered box, got %d", len(lines))
30 }
31
32 // Last element is empty due to trailing newline; bottom bar is at len(lines)-2.
33 top := lines[0]
34 bottom := lines[len(lines)-2]
35
36 if !strings.HasPrefix(top, "┌") || !strings.HasSuffix(top, "┐") {
37 t.Errorf("top bar does not use Single style corners: %q", top)
38 }
39 if !strings.HasPrefix(bottom, "└") || !strings.HasSuffix(bottom, "┘") {
40 t.Errorf("bottom bar does not use Single style corners: %q", bottom)
41 }
42}
43func TestRenderInbuiltStylesPorts(t *testing.T) {
44 tests := []BoxStyle{
45 Single,

Callers

nothing calls this directly

Calls 4

NewBoxFunction · 0.85
StyleMethod · 0.80
PaddingMethod · 0.80
RenderMethod · 0.80

Tested by

no test coverage detected