mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-15 14:34:26 +00:00
23 lines
370 B
Go
23 lines
370 B
Go
package model
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildTrim(t *testing.T) {
|
|
d := make([]byte, 2000)
|
|
rand.Read(d)
|
|
|
|
b := Build{}
|
|
b.Message = fmt.Sprintf("%X", d)
|
|
|
|
if len(b.Message) != 4000 {
|
|
t.Errorf("Failed to generate 4000 byte test string")
|
|
}
|
|
b.Trim()
|
|
if len(b.Message) != 2000 {
|
|
t.Errorf("Failed to trim text string to 2000 bytes")
|
|
}
|
|
}
|