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

Function TestAttributeParser_ExpectCorrectModifiers

parser/attribute_test.go:82–256  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestAttributeParser_ExpectCorrectModifiers(t *testing.T) {
83 type Expected struct {
84 modifiers map[string][]query.Modifier
85 err error
86 }
87 type Case struct {
88 input string
89 expected Expected
90 }
91
92 cases := []Case{
93 {
94 input: "name",
95 expected: Expected{
96 modifiers: map[string][]query.Modifier{"name": {}},
97 err: nil,
98 },
99 },
100 {
101 input: "upper(name)",
102 expected: Expected{
103 modifiers: map[string][]query.Modifier{
104 "name": {
105 {
106 Name: "UPPER",
107 Arguments: []string{},
108 },
109 },
110 },
111 err: nil,
112 },
113 },
114 {
115 input: "format(time, iso)",
116 expected: Expected{
117 modifiers: map[string][]query.Modifier{
118 "time": {
119 {
120 Name: "FORMAT",
121 Arguments: []string{"iso"},
122 },
123 },
124 },
125 err: nil,
126 },
127 },
128 {
129 input: "format(time, \"iso\")",
130 expected: Expected{
131 modifiers: map[string][]query.Modifier{
132 "time": {
133 {
134 Name: "FORMAT",
135 Arguments: []string{"iso"},
136 },
137 },
138 },
139 err: nil,

Callers

nothing calls this directly

Calls 2

parseAttrsMethod · 0.95
NewTokenizerFunction · 0.92

Tested by

no test coverage detected