use a big data slice to validate max row size

This commit is contained in:
Antoine GIRARD 2019-12-02 01:10:28 +01:00
parent 9d8ae4ec3c
commit 10e2ea84be
No known key found for this signature in database
GPG Key ID: F3B46D1708E22963
1 changed files with 8 additions and 2 deletions

View File

@ -7,7 +7,9 @@ package xorm
import (
"errors"
"fmt"
"math/rand"
"testing"
"time"
"github.com/stretchr/testify/assert"
"xorm.io/core"
@ -109,8 +111,12 @@ func TestGetBytesMax(t *testing.T) {
err := testEngine.Sync2(new(Varbinary))
assert.NoError(t, err)
bigData := make([]byte, 80000) //over 8000
rand.Seed(time.Now().UnixNano())
rand.Read(bigData)
cnt, err := testEngine.Insert(&Varbinary{
Data: []byte("test"),
Data: bigData,
})
assert.NoError(t, err)
assert.EqualValues(t, 1, cnt)
@ -119,7 +125,7 @@ func TestGetBytesMax(t *testing.T) {
has, err := testEngine.Get(&b)
assert.NoError(t, err)
assert.Equal(t, true, has)
assert.Equal(t, "test", string(b.Data))
assert.Equal(t, bigData, b.Data)
}
type ConvString string