gilo/internal/editor/fn_test.go
Timothy J. Warren 787166df3a
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good
Move stuff again, just because
2021-04-02 15:36:43 -04:00

38 lines
667 B
Go

package editor
import (
"testing"
)
func TestTruncateString(t *testing.T) {
firstString := "abcdefghijklmnopqrstuvwxyz"
truncated := truncate(firstString, 13)
got := len(truncated)
want := 13
if got != want {
t.Errorf("Truncated length: %q, expected length: %q", got, want)
}
}
func TestTruncateStringNegative(t *testing.T) {
got := truncate("fdlkjf", -5)
want := ""
if got != want {
t.Errorf("Truncated value: %q, expected value: %q", got, want)
}
}
func TestTruncateShorterString(t *testing.T) {
str := "abcdefg"
got := truncate(str, 13)
want := str
if got != want {
t.Errorf("Truncated value: %q, expected value: %q", got, want)
}
}