Skip to content

Commit cb56547

Browse files
committed
Move fuzz
1 parent 5a5fa0d commit cb56547

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

fuzz_test.go renamed to test/fuzz/fuzz_test.go

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package expr_test
1+
package fuzz
22

33
import (
44
"os"
@@ -10,6 +10,15 @@ import (
1010
)
1111

1212
func FuzzExpr(f *testing.F) {
13+
b, err := os.ReadFile("./fuzz_corpus.txt")
14+
if err != nil {
15+
panic(err)
16+
}
17+
corpus := strings.Split(strings.TrimSpace(string(b)), "\n")
18+
for _, s := range corpus {
19+
f.Add(s)
20+
}
21+
1322
env := map[string]interface{}{
1423
"i": 1,
1524
"j": 2,
@@ -20,7 +29,6 @@ func FuzzExpr(f *testing.F) {
2029
"add": func(a, b int) int { return a + b },
2130
"foo": Foo{A: 1, B: 2, Bar: Bar{A: 1, B: 2}},
2231
}
23-
2432
head := expr.Function(
2533
"head",
2634
func(params ...interface{}) (interface{}, error) {
@@ -29,15 +37,6 @@ func FuzzExpr(f *testing.F) {
2937
new(func(int) int),
3038
)
3139

32-
b, err := os.ReadFile("./testdata/fuzz_corpus.txt")
33-
if err != nil {
34-
panic(err)
35-
}
36-
corpus := strings.Split(strings.TrimSpace(string(b)), "\n")
37-
for _, s := range corpus {
38-
f.Add(s)
39-
}
40-
4140
skip := []*regexp.Regexp{
4241
regexp.MustCompile(`cannot fetch .* from .*`),
4342
regexp.MustCompile(`cannot get .* from .*`),

0 commit comments

Comments
 (0)