diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-07-30 18:38:35 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-07-30 18:38:35 +0200 |
| commit | 314ea0c9529c34d53b4249bcf3fbfcd356b0c539 (patch) | |
| tree | 6a2261b2762701bf1ae97d7cfbdbe3515915815a | |
| parent | 6b499767f12c1d48d479899f644916e193f95ba1 (diff) | |
pkg/compiler: refactor regression fuzz test
Reuse most of the existing Fuzz function
rather than duplicate the logic.
| -rw-r--r-- | pkg/compiler/compiler_test.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 823da995d..f701c7b07 100644 --- a/pkg/compiler/compiler_test.go +++ b/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)) } } |
