Support for basic expr functions (num, date, str)

This commit is contained in:
Denis Arh
2020-11-30 20:31:02 +01:00
parent 61469330f3
commit 791b002ed9
26 changed files with 1603 additions and 6 deletions
+30
View File
@@ -0,0 +1,30 @@
package expr
import (
"context"
"github.com/stretchr/testify/require"
"testing"
)
func TestParser(t *testing.T) {
var (
req = require.New(t)
ctx = context.Background()
p = Parser()
e, err = p.NewEvaluable("0 == 0")
result bool
)
req.NoError(err)
result, err = e.EvalBool(ctx, nil)
req.NoError(err)
req.True(result)
}
func Example_simpleExpresion() {
eval(`40 + 2`, nil)
// output:
// 42
}