MCPcopy
hub / github.com/kashav/fsql / TestTokenizer_NextRaw

Function TestTokenizer_NextRaw

tokenizer/tokenizer_test.go:48–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestTokenizer_NextRaw(t *testing.T) {
49 type Case struct {
50 input string
51 expected string
52 }
53
54 // TODO: Fix the last 2 cases, they're currently hanging.
55 cases := []Case{
56 {input: "foo", expected: "foo"},
57 {input: " foo ", expected: "foo"},
58 {input: "\" foo \"", expected: " foo "},
59 {input: "' foo '", expected: " foo "},
60 {input: "` foo `", expected: " foo "},
61 // Case{input: "\"foo'bar\"", expected: "foo'bar"},
62 // Case{input: "\"()\"", expected: "()"},
63 }
64
65 for _, c := range cases {
66 actual := NewTokenizer(c.input).Next()
67 expected := &Token{Type: Identifier, Raw: c.expected}
68 if !reflect.DeepEqual(actual, expected) {
69 t.Fatalf("\nExpected: %v\n Got: %v", expected, actual)
70 }
71 }
72}
73
74func TestTokenizer_AllSimple(t *testing.T) {
75 input := `

Callers

nothing calls this directly

Calls 2

NewTokenizerFunction · 0.85
NextMethod · 0.80

Tested by

no test coverage detected