Files
bbs/internal/view/view_test.go
T
Claude 8cac5066f6 Doc comments on every function
Every function and method, tests included, has a doc comment: what it
is or does, what it returns and anything a caller needs to know.  Only
comments are added; gofmt split a few aligned blocks of one-line
functions once each had its own comment.  The generated protobuf code
is left as protoc writes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-18 21:26:18 +00:00

22 lines
792 B
Go

package view
import "testing"
// TestLayout: columns laid out wide and narrow (the wide-only one left
// out, the widths fitting), and cells cut and padded to their widths.
func TestLayout(t *testing.T) {
cols := []Column{{Title: "Area", Width: 20}, {Title: "Description", Width: 36, Wide: true},
{Title: "Msgs", Width: 5, Right: true}, {Title: "Doing"}}
idx, w := Layout(cols, false, 79)
if len(idx) != 4 || w[0] != 20 || w[1] != 36 || w[2] != 5 || w[3] != 79-20-36-5-3 {
t.Errorf("wide: %v %v", idx, w)
}
idx, w = Layout(cols, true, 38)
if len(idx) != 3 || idx[1] != 2 || w[0]+w[1]+w[2]+2 > 38 {
t.Errorf("narrow: %v %v", idx, w)
}
if got := Cells(cols, []int{0, 2}, []int{6, 5}, []string{"General area", "", "12"}); got != "Genera 12" {
t.Errorf("cells %q", got)
}
}