MCPcopy
hub / github.com/pquerna/ffjson / TestHelloWorld

Function TestHelloWorld

fflib/v1/lexer_test.go:90–208  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestHelloWorld(t *testing.T) {
91 ffl := NewFFLexer([]byte(`{"hello":"world"}`))
92 toks := scanAll(ffl)
93 assertTokensEqual(t, []FFTok{
94 FFTok_left_bracket,
95 FFTok_string,
96 FFTok_colon,
97 FFTok_string,
98 FFTok_right_bracket,
99 FFTok_eof,
100 }, toks)
101
102 ffl = NewFFLexer([]byte(`{"hello": 1}`))
103 toks = scanAll(ffl)
104 assertTokensEqual(t, []FFTok{
105 FFTok_left_bracket,
106 FFTok_string,
107 FFTok_colon,
108 FFTok_integer,
109 FFTok_right_bracket,
110 FFTok_eof,
111 }, toks)
112
113 ffl = NewFFLexer([]byte(`{"hello": 1.0}`))
114 toks = scanAll(ffl)
115 assertTokensEqual(t, []FFTok{
116 FFTok_left_bracket,
117 FFTok_string,
118 FFTok_colon,
119 FFTok_double,
120 FFTok_right_bracket,
121 FFTok_eof,
122 }, toks)
123
124 ffl = NewFFLexer([]byte(`{"hello": 1e2}`))
125 toks = scanAll(ffl)
126 assertTokensEqual(t, []FFTok{
127 FFTok_left_bracket,
128 FFTok_string,
129 FFTok_colon,
130 FFTok_double,
131 FFTok_right_bracket,
132 FFTok_eof,
133 }, toks)
134
135 ffl = NewFFLexer([]byte(`{"hello": {}}`))
136 toks = scanAll(ffl)
137 assertTokensEqual(t, []FFTok{
138 FFTok_left_bracket,
139 FFTok_string,
140 FFTok_colon,
141 FFTok_left_bracket,
142 FFTok_right_bracket,
143 FFTok_right_bracket,
144 FFTok_eof,
145 }, toks)
146
147 ffl = NewFFLexer([]byte(`{"hello": {"blah": null}}`))

Callers

nothing calls this directly

Calls 3

NewFFLexerFunction · 0.85
scanAllFunction · 0.85
assertTokensEqualFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…