MCPcopy Create free account
hub / github.com/expr-lang/expr / TestCompile_panic

Function TestCompile_panic

compiler/compiler_test.go:411–424  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

409}
410
411func TestCompile_panic(t *testing.T) {
412 tests := []string{
413 `(TotalPosts.Profile[Authors > TotalPosts == get(nil, TotalLikes)] > Authors) ^ (TotalLikes / (Posts?.PublishDate[TotalPosts] < Posts))`,
414 `one(Posts, nil)`,
415 `trim(TotalViews, Posts) <= get(Authors, nil)`,
416 `Authors.IsZero(nil * Authors) - (TotalViews && Posts ? nil : nil)[TotalViews.IsZero(false, " ").IsZero(Authors)]`,
417 }
418 for _, test := range tests {
419 t.Run(test, func(t *testing.T) {
420 _, err := expr.Compile(test, expr.Env(playground.Blog{}))
421 require.Error(t, err)
422 })
423 }
424}
425
426func TestCompile_FuncTypes(t *testing.T) {
427 env := map[string]any{

Callers

nothing calls this directly

Calls 4

CompileFunction · 0.92
EnvStruct · 0.92
ErrorFunction · 0.92
RunMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…