| 1571 | } |
| 1572 | |
| 1573 | func TestExpr_map_default_values(t *testing.T) { |
| 1574 | env := map[string]any{ |
| 1575 | "foo": map[string]string{}, |
| 1576 | "bar": map[string]*string{}, |
| 1577 | } |
| 1578 | |
| 1579 | input := `foo['missing'] == '' && bar['missing'] == nil` |
| 1580 | |
| 1581 | program, err := expr.Compile(input, expr.Env(env)) |
| 1582 | require.NoError(t, err) |
| 1583 | |
| 1584 | output, err := expr.Run(program, env) |
| 1585 | require.NoError(t, err) |
| 1586 | require.Equal(t, true, output) |
| 1587 | } |
| 1588 | |
| 1589 | func TestExpr_map_default_values_compile_check(t *testing.T) { |
| 1590 | tests := []struct { |