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

Function TestParser_ParseFrom

parser/parser_test.go:104–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestParser_ParseFrom(t *testing.T) {
105 type Expected struct {
106 sources map[string][]string
107 aliases map[string]string
108 err error
109 }
110
111 type Case struct {
112 input string
113 expected Expected
114 }
115
116 u, err := user.Current()
117 if err != nil {
118 // TODO: If we can't get the current user, should we fatal or just return?
119 return
120 }
121
122 cases := []Case{
123 {
124 input: "WHERE",
125 expected: Expected{
126 sources: map[string][]string{
127 "include": {"."},
128 "exclude": {},
129 },
130 aliases: map[string]string{},
131 err: nil,
132 },
133 },
134
135 {
136 input: "FROM .",
137 expected: Expected{
138 sources: map[string][]string{
139 "include": {"."},
140 "exclude": {},
141 },
142 aliases: map[string]string{},
143 err: nil,
144 },
145 },
146
147 {
148 input: "FROM ~/foo, -./.git/",
149 expected: Expected{
150 sources: map[string][]string{
151 "include": {u.HomeDir + "/foo"},
152 "exclude": {".git"},
153 },
154 aliases: map[string]string{},
155 err: nil,
156 },
157 },
158
159 {
160 input: "FROM ./foo/ AS foo",
161 expected: Expected{

Callers

nothing calls this directly

Calls 3

NewQueryFunction · 0.92
NewTokenizerFunction · 0.92
parseFromClauseMethod · 0.80

Tested by

no test coverage detected