Update fuzz tests

This commit is contained in:
Anton Medvedev
2025-03-08 16:19:30 +01:00
parent 7e417b043e
commit 6c8437454d
6 changed files with 13268 additions and 10038 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ func (v *checker) IdentifierNode(node *ast.IdentifierNode) Nature {
return unknown
}
return v.ident(node, node.Value, v.config.Env.Strict, true)
return v.ident(node, node.Value, v.config.Strict, true)
}
// ident method returns type of environment variable, builtin or function.
+1 -1
View File
@@ -62,9 +62,9 @@ func New(env any) *Config {
}
func (c *Config) WithEnv(env any) {
c.Strict = true
c.EnvObject = env
c.Env = Env(env)
c.Strict = c.Env.Strict
}
func (c *Config) ConstExpr(name string) {
+1
View File
@@ -36,6 +36,7 @@ func Env(env any) Nature {
n := Nature{
Type: v.Type(),
Fields: make(map[string]Nature, v.Len()),
Strict: true,
}
for _, key := range v.MapKeys() {
+8
View File
@@ -2716,3 +2716,11 @@ func TestIssue758_filter_map_index(t *testing.T) {
require.Equal(t, expected, result)
}
func TestExpr_wierd_cases(t *testing.T) {
env := map[string]any{}
_, err := expr.Compile(`A(A)`, expr.Env(env))
require.Error(t, err)
require.Contains(t, err.Error(), "unknown name A")
}
+13254 -10036
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -51,6 +51,9 @@ func FuzzExpr(f *testing.F) {
regexp.MustCompile(`cannot parse .* as .*`),
regexp.MustCompile(`operator "in" not defined on .*`),
regexp.MustCompile(`cannot sum .*`),
regexp.MustCompile(`index out of range: .* \(array length is .*\)`),
regexp.MustCompile(`cannot use <nil> as argument \(type .*\) to call .*`),
regexp.MustCompile(`illegal base64 data at input byte .*`),
}
env := NewEnv()