From 314ea0c9529c34d53b4249bcf3fbfcd356b0c539 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 30 Jul 2019 18:38:35 +0200 Subject: pkg/compiler: refactor regression fuzz test Reuse most of the existing Fuzz function rather than duplicate the logic. --- pkg/compiler/compiler_test.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'pkg') 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)) } } -- cgit mrf-deployment