MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestConfigErrors

Function TestConfigErrors

policy/config_test.go:113–242  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

111}
112
113func TestConfigErrors(t *testing.T) {
114 tests := []struct {
115 config string
116 err string
117 }{
118 {
119 config: `
120extensions:
121 - name: "bad_name"`,
122 err: "unrecognized extension: bad_name",
123 },
124 {
125 config: `
126variables:
127 - name: "bad_type"
128 type:
129 type_name: "strings"`,
130 err: `invalid variable "bad_type": undefined type name: "strings"`,
131 },
132 {
133 config: `
134variables:
135 - name: "bad_list"
136 type:
137 type_name: "list"`,
138 err: `invalid variable "bad_list": invalid type: list expects 1 parameter, got 0`,
139 },
140 {
141 config: `
142variables:
143 - name: "bad_map"
144 type:
145 type_name: "map"
146 params:
147 - type_name: "string"`,
148 err: `invalid variable "bad_map": invalid type: map expects 2 parameters, got 1`,
149 },
150 {
151 config: `
152variables:
153 - name: "bad_list_type_param"
154 type:
155 type_name: "list"
156 params:
157 - type_name: "number"`,
158 err: `invalid variable "bad_list_type_param": undefined type name: "number"`,
159 },
160 {
161 config: `
162variables:
163 - name: "bad_map_type_param"
164 type:
165 type_name: "map"
166 params:
167 - type_name: "string"
168 - type_name: "invalid_opaque_type"`,
169 err: `invalid variable "bad_map_type_param": undefined type name: "invalid_opaque_type"`,
170 },

Callers

nothing calls this directly

Calls 6

ExtendMethod · 0.95
NewEnvFunction · 0.92
OptionalTypesFunction · 0.92
parseConfigYamlFunction · 0.85
FromConfigFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected