From acf69c5ed9f8722bd1659342b7de4dfbaf3fef91 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 15 Mar 2020 22:39:02 +0100 Subject: pkg/compiler: handle errors in test Currnetly we don't have any errors in this test, but if we get some, it crashes with nil deref. --- pkg/compiler/compiler_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pkg/compiler') diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 4ea5b2721..f1c18f9ee 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -230,11 +230,14 @@ s2 { f3 array[array[s1, 2], 2] } ` - desc := ast.Parse([]byte(input), "input", nil) + eh := func(pos ast.Pos, msg string) { + t.Errorf("%v: %v", pos, msg) + } + desc := ast.Parse([]byte(input), "input", eh) if desc == nil { t.Fatal("failed to parse") } - p := Compile(desc, map[string]uint64{"SYS_foo": 1}, targets.List["test"]["64"], nil) + p := Compile(desc, map[string]uint64{"SYS_foo": 1}, targets.List["test"]["64"], eh) if p == nil { t.Fatal("failed to compile") } -- cgit mrf-deployment