(t *testing.T)
| 2268 | } |
| 2269 | |
| 2270 | func TestInterpreter_MissingIdentInSelect(t *testing.T) { |
| 2271 | src := common.NewTextSource(`a.b.c`) |
| 2272 | parsed := testMustParse(t, src) |
| 2273 | cont := testContainer("test") |
| 2274 | reg := newTestRegistry(t) |
| 2275 | env := newTestEnv(t, cont, reg) |
| 2276 | env.AddIdents(decls.NewVariable("a.b", types.DynType)) |
| 2277 | checked, errors := checker.Check(parsed, src, env) |
| 2278 | if len(errors.GetErrors()) != 0 { |
| 2279 | t.Fatal(errors.ToDisplayString()) |
| 2280 | } |
| 2281 | |
| 2282 | attrs := NewPartialAttributeFactory(cont, reg, reg) |
| 2283 | interp := newStandardInterpreter(t, cont, reg, reg, attrs) |
| 2284 | i, _ := interp.NewInterpretable(checked) |
| 2285 | vars, _ := NewPartialActivation( |
| 2286 | map[string]any{ |
| 2287 | "a.b": map[string]any{ |
| 2288 | "d": "hello", |
| 2289 | }, |
| 2290 | }, |
| 2291 | NewAttributePattern("a.b").QualString("c")) |
| 2292 | result := i.Eval(vars) |
| 2293 | if !types.IsUnknown(result) { |
| 2294 | t.Errorf("Got %v, wanted unknown", result) |
| 2295 | } |
| 2296 | |
| 2297 | result = i.Eval(EmptyActivation()) |
| 2298 | if !types.IsError(result) { |
| 2299 | t.Errorf("Got %v, wanted error", result) |
| 2300 | } |
| 2301 | } |
| 2302 | |
| 2303 | func TestInterpreter_TypeConversionOpt(t *testing.T) { |
| 2304 | tests := []struct { |
nothing calls this directly
no test coverage detected