Debian Codegraph @

scanner_test.go

raw symbols ◀ ▶ SCIP
2 Debian patches touch this file
1 package humanlog
2
3 import (
4 "context"
5 "strings"
6 "testing"
7
8 "github.com/humanlogio/humanlog/internal/pkg/model"
•9 "github.com/humanlogio/humanlog/pkg/sink/bufsink"
10 "github.com/stretchr/testify/require"
11 )
12
13 func TestScannerLongLine(t *testing.T) {
14 data := `{"msg":"` + strings.Repeat("a", 1023*1024) + `"}`
15 ctx := context.Background()
16 src := strings.NewReader(data)
17 want := []model.Event{
18 {Raw: []byte(data), Structured: &model.Structured{Msg: strings.Repeat("a", 1023*1024)}},
19 }
20 sink := bufsink.NewSizedBufferedSink(100, nil)
21 err := Scan(ctx, src, sink, DefaultOptions())
22 require.NoError(t, err, "got %#v", err)
23 require.Equal(t, want, sink.Buffered)
24 }