MCPcopy Create free account
hub / github.com/box-cli-maker/box-cli-maker / TestManualBorderOverridesAfterStyle

Function TestManualBorderOverridesAfterStyle

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

Source from the content-addressed store, hash-verified

120}
121
122func TestManualBorderOverridesAfterStyle(t *testing.T) {
123 b := NewBox().
124 Style(Double).
125 TopLeft("*").
126 TopRight("*").
127 BottomLeft("*").
128 BottomRight("*")
129
130 out, err := b.Render("Title", "Content")
131 if err != nil {
132 t.Fatalf("Render returned error: %v", err)
133 }
134 lines := strings.Split(out, "\n")
135 if len(lines) < 3 {
136 t.Fatalf("expected at least 3 lines in rendered box, got %d", len(lines))
137 }
138 top := lines[0]
139 bottom := lines[len(lines)-2]
140
141 if !strings.HasPrefix(top, "*") || !strings.HasSuffix(top, "*") {
142 t.Errorf("expected custom top corners '*', got %q", top)
143 }
144 if !strings.HasPrefix(bottom, "*") || !strings.HasSuffix(bottom, "*") {
145 t.Errorf("expected custom bottom corners '*', got %q", bottom)
146 }
147
148 if !strings.Contains(top, "═") || !strings.Contains(bottom, "═") {
149 t.Errorf("expected Double style horizontal borders '═', got top=%q bottom=%q", top, bottom)
150 }
151}
152
153func TestBoxCopy(t *testing.T) {
154 t.Run("independent copies", func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

NewBoxFunction · 0.85
BottomRightMethod · 0.80
BottomLeftMethod · 0.80
TopRightMethod · 0.80
TopLeftMethod · 0.80
StyleMethod · 0.80
RenderMethod · 0.80

Tested by

no test coverage detected