Skip to content

Commit 8f0751d

Browse files
committed
Update fuzz tests
1 parent 4a3a8b6 commit 8f0751d

File tree

6 files changed

+13268
-10038
lines changed

6 files changed

+13268
-10038
lines changed

checker/checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func (v *checker) IdentifierNode(node *ast.IdentifierNode) Nature {
217217
return unknown
218218
}
219219

220-
return v.ident(node, node.Value, v.config.Env.Strict, true)
220+
return v.ident(node, node.Value, v.config.Strict, true)
221221
}
222222

223223
// ident method returns type of environment variable, builtin or function.

conf/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ func New(env any) *Config {
6262
}
6363

6464
func (c *Config) WithEnv(env any) {
65-
c.Strict = true
6665
c.EnvObject = env
6766
c.Env = Env(env)
67+
c.Strict = c.Env.Strict
6868
}
6969

7070
func (c *Config) ConstExpr(name string) {

conf/env.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func Env(env any) Nature {
3636
n := Nature{
3737
Type: v.Type(),
3838
Fields: make(map[string]Nature, v.Len()),
39+
Strict: true,
3940
}
4041

4142
for _, key := range v.MapKeys() {

expr_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,3 +2716,11 @@ func TestIssue758_filter_map_index(t *testing.T) {
27162716

27172717
require.Equal(t, expected, result)
27182718
}
2719+
2720+
func TestExpr_wierd_cases(t *testing.T) {
2721+
env := map[string]any{}
2722+
2723+
_, err := expr.Compile(`A(A)`, expr.Env(env))
2724+
require.Error(t, err)
2725+
require.Contains(t, err.Error(), "unknown name A")
2726+
}

0 commit comments

Comments
 (0)