MCPcopy Create free account
hub / github.com/segmentio/encoding / TestTokenizer

Function TestTokenizer

json/token_test.go:74–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestTokenizer(t *testing.T) {
75 tests := []struct {
76 input []byte
77 tokens []token
78 }{
79 {
80 input: []byte(`null`),
81 tokens: []token{
82 value(`null`, 0, 0),
83 },
84 },
85
86 {
87 input: []byte(`true`),
88 tokens: []token{
89 value(`true`, 0, 0),
90 },
91 },
92
93 {
94 input: []byte(`false`),
95 tokens: []token{
96 value(`false`, 0, 0),
97 },
98 },
99
100 {
101 input: []byte(`""`),
102 tokens: []token{
103 value(`""`, 0, 0),
104 },
105 },
106
107 {
108 input: []byte(`"Hello World!"`),
109 tokens: []token{
110 value(`"Hello World!"`, 0, 0),
111 },
112 },
113
114 {
115 input: []byte(`-0.1234`),
116 tokens: []token{
117 value(`-0.1234`, 0, 0),
118 },
119 },
120
121 {
122 input: []byte(` { } `),
123 tokens: []token{
124 delim(`{`, 0, 0),
125 delim(`}`, 0, 0),
126 },
127 },
128
129 {
130 input: []byte(`{ "answer": 42 }`),
131 tokens: []token{

Callers

nothing calls this directly

Calls 5

valueFunction · 0.85
delimFunction · 0.85
tokenizeFunction · 0.85
keyFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…