1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-01-05 10:20:36 +02:00
woodpecker/model/build_test.go

24 lines
370 B
Go
Raw Normal View History

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