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

Function ExampleAsBool_error

expr_test.go:289–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287}
288
289func ExampleAsBool_error() {
290 env := map[string]any{
291 "foo": 0,
292 }
293
294 _, err := expr.Compile("foo + 42", expr.Env(env), expr.AsBool())
295
296 fmt.Printf("%v", err)
297
298 // Output: expected bool, but got int
299}
300
301func ExampleAsInt() {
302 program, err := expr.Compile("42", expr.AsInt())

Callers

nothing calls this directly

Calls 4

CompileFunction · 0.92
EnvStruct · 0.92
AsBoolFunction · 0.92
PrintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…