Skip to content

expr.AsBool() not working in this case #830

Description

@Levi-Wu-777

In this case, I do expr.Compile with expr.AsBool(), and expect expr.Run will return output == false and err == nil.
But instead, it return output == nil and err == nil, which violate the expr.AsBool() command.

import (
"github.com/expr-lang/expr"
"github.com/stretchr/testify/assert"
)
func Test_expr(t *testing.T) {
program, err = expr.Compile("varNotExist", expr.AllowUndefinedVariables(), expr.AsBool())
assert.Nil(t, err)
output, err = expr.Run(program, map[string]interface{}{})
assert.Nil(t, err)
assert.Equal(t, nil, output)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions