Skip to content
Permalink
Browse files

pkg/compiler: refactor regression fuzz test

Reuse most of the existing Fuzz function
rather than duplicate the logic.
  • Loading branch information...
dvyukov committed Jul 30, 2019
1 parent 6b49976 commit 314ea0c9529c34d53b4249bcf3fbfcd356b0c539
Showing with 5 additions and 11 deletions.
  1. +5 −11 pkg/compiler/compiler_test.go
@@ -189,7 +189,7 @@ func TestWarnings(t *testing.T) {

func TestFuzz(t *testing.T) {
t.Parallel()
inputs := []string{
for _, data := range []string{
"d~^gB̉`i\u007f?\xb0.",
"da[",
"define\x98define(define\x98define\x98define\x98define\x98define)define\tdefin",
@@ -199,16 +199,10 @@ l t
]`,
`t()D[0]
type D[e]l`,
}
consts := map[string]uint64{"A": 1, "B": 2, "C": 3, "SYS_A": 4, "SYS_B": 5, "SYS_C": 6}
eh := func(pos ast.Pos, msg string) {
t.Logf("%v: %v", pos, msg)
}
for _, data := range inputs {
desc := ast.Parse([]byte(data), "", eh)
if desc != nil {
Compile(desc, consts, targets.List["test"]["64"], eh)
}
"E",
"#",
} {
Fuzz([]byte(data))
}
}

0 comments on commit 314ea0c

Please sign in to comment.
You can’t perform that action at this time.