woodpecker/model/build_test.go

24 lines
370 B
Go
Raw Normal View History

2017-05-14 17:57:38 +00:00
package model
import (
"crypto/rand"
"fmt"
"testing"
)
func TestBuildTrim(t *testing.T) {
2017-05-14 17:59:13 +00:00
d := make([]byte, 2000)
2017-05-14 17:57:38 +00:00
rand.Read(d)
b := Build{}
b.Message = fmt.Sprintf("%X", d)
2017-05-14 17:59:13 +00:00
if len(b.Message) != 4000 {
t.Errorf("Failed to generate 4000 byte test string")
2017-05-14 17:57:38 +00:00
}
b.Trim()
2017-05-14 17:59:13 +00:00
if len(b.Message) != 2000 {
t.Errorf("Failed to trim text string to 2000 bytes")
2017-05-14 17:57:38 +00:00
}
}