blob: 967815711b4e2e16919956c2f75576844a9a3580 [file] [log] [blame]
Akrone396a932021-10-19 01:06:13 +02001package datok
2
3import (
4 "bytes"
5 "testing"
6
7 "github.com/stretchr/testify/assert"
8)
9
10func TestTokenWriterSimple(t *testing.T) {
11 assert := assert.New(t)
12
13 b := make([]byte, 0, 2048)
14 w := bytes.NewBuffer(b)
15
16 tws := NewTokenWriterSimple(w)
17
18 assert.NotNil(tws)
19
20 tws.Token(0, []rune{'a', 'b', 'c'})
21
22 tws.Token(0, []rune{'d', 'e', 'f'})
23
24 tws.SentenceEnd()
25
26 tws.Flush()
27
28 assert.Equal("abc\ndef\n\n", w.String())
29}