-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get simple test case to work #69
Comments
Hi, Try this fix: expression := "beliefs['temp'] > 60 and beliefs['temp'] < 76"
env := map[string]interface{}{
`beliefs`: map[string]interface{}{
`temp`: 58.6,
},
}
- out, err := expr.Eval(expression, expr.Env(env))
+ out, err := expr.Eval(expression, env)
if err != nil {
t.Errorf("Expected no errors. Got: %v", err)
}
if out != false {
t.Errorf("Expecte `false`, got: %v", out)
} |
Also, I've added check what in future this misuse should be notified: 4d40254 |
Yes... I've been working it today without the Env wrapper and it works fine. What is the point of the Env wrapper then? It creates a type table of some sort? |
Yes, |
I see... so I only use it with Compile, and not with Eval.
P.
…On Thu, Sep 26, 2019 at 3:36 PM Anton Medvedev ***@***.***> wrote:
Yes, expr.Env creates type tables for type checker. Take a look at this
example: https://godoc.org/github.com/antonmedv/expr#example-Compile
Compile ahead of time will allow faster execution and type checking of
expression before going to production.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#69>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIGJPZEPBZ3QTST6XWRBLTQLU2PNANCNFSM4I24NUKQ>
.
|
Seems straightforward, but for the life of me, can't get this to work. Keep getting
ca_test.go:19: Expected no errors. Got: undefined: beliefs
:The text was updated successfully, but these errors were encountered: