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

Function TestMustRenderSuccessAndPanic

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

Source from the content-addressed store, hash-verified

472}
473
474func TestMustRenderSuccessAndPanic(t *testing.T) {
475 // Success case: MustRender should not panic when Render succeeds.
476 t.Run("success", func(t *testing.T) {
477 b := NewBox().Padding(1, 1).Style(Single)
478 _ = b.MustRender("Title", "Content")
479 })
480
481 // Panic case: invalid style causes Render to error, hence MustRender panics.
482 t.Run("panic", func(t *testing.T) {
483 defer func() {
484 if r := recover(); r == nil {
485 t.Fatalf("expected MustRender to panic for invalid style, but it did not")
486 }
487 }()
488 b := NewBox().Padding(1, 1).Style(BoxStyle("InvalidStyle"))
489 _ = b.MustRender("Title", "Content")
490 })
491}
492
493func TestRenderEmojiBordersHaveConsistentWidth(t *testing.T) {
494 b := NewBox().Padding(2, 1)

Callers

nothing calls this directly

Calls 5

NewBoxFunction · 0.85
BoxStyleTypeAlias · 0.85
StyleMethod · 0.80
PaddingMethod · 0.80
MustRenderMethod · 0.80

Tested by

no test coverage detected