File size: 420 Bytes
8ab4ccd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package diffview
import (
"testing"
)
func TestPad(t *testing.T) {
tests := []struct {
input any
width int
expected string
}{
{7, 2, " 7"},
{7, 3, " 7"},
{"a", 2, " a"},
{"a", 3, " a"},
{"…", 2, " …"},
{"…", 3, " …"},
}
for _, tt := range tests {
result := pad(tt.input, tt.width)
if result != tt.expected {
t.Errorf("expected %q, got %q", tt.expected, result)
}
}
}
|