MCPcopy
hub / github.com/expr-lang/expr / TestCheck_EmbeddedInterface

Function TestCheck_EmbeddedInterface

checker/checker_test.go:1114–1136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1112}
1113
1114func TestCheck_EmbeddedInterface(t *testing.T) {
1115 t.Run("embedded interface lookup returns compile-error not panic", func(t *testing.T) {
1116 type Env struct {
1117 context.Context
1118 Country string
1119 }
1120 type Wrapper struct {
1121 Ctx Env
1122 }
1123
1124 config := conf.New(Wrapper{
1125 Ctx: Env{
1126 Context: context.Background(),
1127 Country: "TR",
1128 },
1129 })
1130 expr.WithContext("Ctx")(config)
1131
1132 _, err := checker.ParseCheck("Ctx.C", config)
1133 require.Error(t, err)
1134 require.Contains(t, err.Error(), "has no field C")
1135 })
1136}
1137
1138func TestCheck_types(t *testing.T) {
1139 env := types.Map{

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
WithContextFunction · 0.92
ParseCheckFunction · 0.92
ErrorFunction · 0.92
ContainsFunction · 0.92
RunMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…