Skip to content

Commit 23dba4e

Browse files
authored
Merge branch 'master' into vm-and-runtime-improvements
2 parents a3d86ee + 69b27af commit 23dba4e

File tree

3 files changed

+41
-17
lines changed

3 files changed

+41
-17
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ func main() {
149149
* [GoDaddy](https://godaddy.com) employs Expr for the customization of its GoDaddy Pro product.
150150
* [ByteDance](https://bytedance.com) incorporates Expr into its internal business rule engine.
151151
* [Aviasales](https://aviasales.ru) utilizes Expr as a business rule engine for its flight search engine.
152-
* [Wish.com](https://www.wish.com) employs Expr in its decision-making rule engine for the Wish Assistant.
153-
* [Naoma.AI](https://www.naoma.ai) uses Expr as a part of its call scoring engine.
152+
* [Alibaba](https://alibaba.com) uses Expr in a web framework for building recommendation services.
154153
* [Argo](https://argoproj.github.io) integrates Expr into Argo Rollouts and Argo Workflows for Kubernetes.
154+
* [Wish.com](https://www.wish.com) employs Expr in its decision-making rule engine for the Wish Assistant.
155155
* [OpenTelemetry](https://opentelemetry.io) integrates Expr into the OpenTelemetry Collector.
156156
* [Philips Labs](https://github.com/philips-labs/tabia) employs Expr in Tabia, a tool designed to collect insights on their code bases.
157157
* [CrowdSec](https://crowdsec.net) incorporates Expr into its security automation tool.
@@ -172,6 +172,7 @@ func main() {
172172
* [FastSchema](https://github.com/fastschema/fastschema) - A BaaS leveraging Expr for its customizable and dynamic Access Control system.
173173
* [WunderGraph Cosmo](https://github.com/wundergraph/cosmo) - GraphQL Federeration Router uses Expr to customize Middleware behaviour
174174
* [SOLO](https://solo.one) uses Expr interally to allow dynamic code execution with custom defined functions.
175+
* [Naoma.AI](https://www.naoma.ai) uses Expr as a part of its call scoring engine.
175176

176177
[Add your company too](https://github.com/expr-lang/expr/edit/master/README.md)
177178

expr_test.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,23 +2318,16 @@ func TestEval_slices_out_of_bound(t *testing.T) {
23182318
}
23192319
}
23202320

2321-
func TestExpr_custom_tests(t *testing.T) {
2322-
f, err := os.Open("custom_tests.json")
2323-
if os.IsNotExist(err) {
2324-
t.Skip("no custom tests")
2325-
return
2321+
func TestExpr_timeout(t *testing.T) {
2322+
tests := []struct{ code string }{
2323+
{`-999999..999999`},
2324+
{`map(1..999999, 1..999999)`},
2325+
{`map(1..999999, repeat('a', #))`},
23262326
}
23272327

2328-
require.NoError(t, err, "open file error")
2329-
defer f.Close()
2330-
2331-
var tests []string
2332-
err = json.NewDecoder(f).Decode(&tests)
2333-
require.NoError(t, err, "decode json error")
2334-
2335-
for id, tt := range tests {
2336-
t.Run(fmt.Sprintf("line %v", id+2), func(t *testing.T) {
2337-
program, err := expr.Compile(tt)
2328+
for _, tt := range tests {
2329+
t.Run(tt.code, func(t *testing.T) {
2330+
program, err := expr.Compile(tt.code)
23382331
require.NoError(t, err)
23392332

23402333
timeout := make(chan bool, 1)

test/issues/840/issue_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package issue_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/expr-lang/expr"
7+
"github.com/expr-lang/expr/internal/testify/require"
8+
)
9+
10+
func TestEnvFieldMethods(t *testing.T) {
11+
program, err := expr.Compile(`Func(0)`, expr.Env(&Env{}))
12+
require.NoError(t, err)
13+
14+
env := &Env{}
15+
env.Func = func() int {
16+
return 42
17+
}
18+
19+
out, err := expr.Run(program, Env{})
20+
require.NoError(t, err)
21+
22+
require.Equal(t, 42, out)
23+
}
24+
25+
type Env struct {
26+
EmbeddedEnv
27+
Func func() int
28+
}
29+
30+
type EmbeddedEnv struct{}

0 commit comments

Comments
 (0)