...
1 package pgproto3_test
2
3 import (
4 "testing"
5
6 "github.com/jackc/pgproto3/v2"
7 "github.com/stretchr/testify/require"
8 )
9
10 func TestQueryBiggerThanMaxMessageBodyLen(t *testing.T) {
11 t.Parallel()
12
13
14 _, err := (&pgproto3.Query{String: string(make([]byte, pgproto3.MaxMessageBodyLen-5))}).Encode(nil)
15 require.NoError(t, err)
16
17
18 _, err = (&pgproto3.Query{String: string(make([]byte, pgproto3.MaxMessageBodyLen-4))}).Encode(nil)
19 require.Error(t, err)
20 }
21
View as plain text