Download internal/ui/diffview/util_test.go from SaylorTwift/crush: direct link, hf CLI and curl.
- Browser
- Download file 420 Bytes
-
https://huggingface.co/SaylorTwift/crush/resolve/main/internal/ui/diffview/util_test.go
- Command line
-
hf download hf://SaylorTwift/crush/internal/ui/diffview/util_test.go
-
curl -L -o util_test.go https://huggingface.co/SaylorTwift/crush/resolve/main/internal/ui/diffview/util_test.go
420 Bytes
| 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) | |
| } | |
| } | |
| } | |