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

Function TestRenderNonTTYLWrapContent

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

Source from the content-addressed store, hash-verified

322}
323
324func TestRenderNonTTYLWrapContent(t *testing.T) {
325 oldIsTTY := isTTY
326 defer func() { isTTY = oldIsTTY }() // restore after test
327
328 isTTY = func(fd uintptr) bool { return false } // mock as non-TTY
329 b := NewBox().Padding(1, 1).Style(Single).WrapContent(true)
330
331 if _, err := b.Render("Title", "Content"); err == nil {
332 t.Fatalf("expected error for non TTY output with wrapping enabled, got nil")
333 } else if !strings.Contains(err.Error(), "cannot determine terminal width") {
334 t.Errorf("unexpected error message for non TTY wrap content: %v", err)
335 }
336}
337
338func TestRenderNegativePadding(t *testing.T) {
339 // Horizontal padding < 0.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected