Skip to content

Commit 72749ef

Browse files
committed
Update fuzz_test.go
1 parent e9b1e31 commit 72749ef

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

fuzz_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func FuzzExpr(f *testing.F) {
4242
`i <= j`,
4343
`i in a`,
4444
`i not in a`,
45-
`i in m`,
45+
`s in m`,
4646
`m.a`,
4747
`m.m.a`,
4848
`a[0]`,
@@ -59,7 +59,7 @@ func FuzzExpr(f *testing.F) {
5959
`string(i)`,
6060
`trim(" a ")`,
6161
`trim("_a_", "_")`,
62-
`trimPrefix(" a")`,
62+
`trimPrefix(" a", " ")`,
6363
`trimSuffix("a ")`,
6464
`upper("a")`,
6565
`lower("A")`,
@@ -116,6 +116,9 @@ func FuzzExpr(f *testing.F) {
116116
regexp.MustCompile(`reflect: call of reflect.Value.Call on .* Value`),
117117
regexp.MustCompile(`reflect: call of reflect.Value.Index on map Value`),
118118
regexp.MustCompile(`reflect: call of reflect.Value.Len on .* Value`),
119+
regexp.MustCompile(`strings: negative Repeat count`),
120+
regexp.MustCompile(`strings: illegal bytes to escape`),
121+
regexp.MustCompile(`operator "in" not defined on int`),
119122
}
120123

121124
skipCode := []string{
@@ -125,25 +128,25 @@ func FuzzExpr(f *testing.F) {
125128
f.Fuzz(func(t *testing.T, code string) {
126129
for _, skipCase := range skipCode {
127130
if strings.Contains(code, skipCase) {
128-
t.Skip()
131+
t.Skipf("skip code: %s", skipCase)
129132
return
130133
}
131134
}
132135

133-
program, err := expr.Compile(code, expr.Env(env), fn)
136+
program, err := expr.Compile(code, expr.Env(env), fn, expr.ExperimentalPipes())
134137
if err != nil {
135-
t.Skip()
138+
t.Skipf("compile error: %s", err)
136139
}
137140

138141
_, err = expr.Run(program, env)
139142
if err != nil {
140143
for _, okCase := range okCases {
141144
if okCase.MatchString(err.Error()) {
142-
t.Skip()
145+
t.Skipf("skip error: %s", err)
143146
return
144147
}
145148
}
146-
t.Errorf("code: %s, err: %s", code, err)
149+
t.Errorf("code: %s\nerr: %s", code, err)
147150
}
148151
})
149152
}

0 commit comments

Comments
 (0)