Debian Codegraph @

internal/kallsyms/reader_test.go

raw symbols SCIP
1 package kallsyms
2
3 import (
4 "bytes"
5 "testing"
6
7 "github.com/go-quicktest/qt"
8 )
9
10 func TestReader(t *testing.T) {
11 b := []byte(`
12 one two three
13 four
14
15 λέξη `)
16
17 r := newReader(bytes.NewReader(b))
18
19 qt.Assert(t, qt.IsTrue(r.Line()))
20 qt.Assert(t, qt.IsTrue(r.Word()))
21 qt.Assert(t, qt.Equals(r.Text(), "one"))
22
23 qt.Assert(t, qt.IsTrue(r.Word()))
24 qt.Assert(t, qt.Equals(r.Text(), "two"))
25
26 qt.Assert(t, qt.IsTrue(r.Word()))
27 qt.Assert(t, qt.Equals(r.Text(), "three"))
28 qt.Assert(t, qt.IsFalse(r.Word()))
29
30 qt.Assert(t, qt.IsTrue(r.Line()))
31 qt.Assert(t, qt.IsTrue(r.Word()))
32 qt.Assert(t, qt.Equals(r.Text(), "four"))
33 qt.Assert(t, qt.IsFalse(r.Word()))
34
35 qt.Assert(t, qt.IsTrue(r.Line()))
36 qt.Assert(t, qt.IsTrue(r.Word()))
37 qt.Assert(t, qt.Equals(r.Text(), "λέξη"))
38 qt.Assert(t, qt.IsFalse(r.Word()))
39
40 qt.Assert(t, qt.IsFalse(r.Line()))
41 qt.Assert(t, qt.IsNil(r.Err()))
42 }