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

Function TestFindAlign

util_test.go:113–143  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

111}
112
113func TestFindAlign(t *testing.T) {
114 cases := []struct {
115 name string
116 align AlignType
117 want string
118 wantOK bool
119 }{
120 {"default-left", "", leftAlign, true},
121 {"left", Left, leftAlign, true},
122 {"center", Center, centerAlign, true},
123 {"right", Right, rightAlign, true},
124 {"invalid", AlignType("Invalid"), "", false},
125 }
126
127 for _, tt := range cases {
128 t.Run(tt.name, func(t *testing.T) {
129 b := &Box{}
130 b.contentAlign = tt.align
131 got, err := b.findAlign()
132 if tt.wantOK && err != nil {
133 t.Fatalf("unexpected error: %v", err)
134 }
135 if !tt.wantOK && err == nil {
136 t.Fatalf("expected error for invalid align, got nil")
137 }
138 if tt.wantOK && got != tt.want {
139 t.Errorf("expected %q, got %q", tt.want, got)
140 }
141 })
142 }
143}
144
145func TestRepeatWithString(t *testing.T) {
146 got := repeatWithString("-", 10, "hi")

Callers

nothing calls this directly

Calls 2

findAlignMethod · 0.95
AlignTypeTypeAlias · 0.85

Tested by

no test coverage detected