diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-03-15 22:39:02 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-03-17 21:19:13 +0100 |
| commit | acf69c5ed9f8722bd1659342b7de4dfbaf3fef91 (patch) | |
| tree | 55373c68d7329bf25cf612a08994a0e1b38c2aaa /pkg/compiler | |
| parent | 3e872ba1c495feafaafac97cc449f81d8a4d451f (diff) | |
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.
Diffstat (limited to 'pkg/compiler')
| -rw-r--r-- | pkg/compiler/compiler_test.go | 7 |
1 files changed, 5 insertions, 2 deletions
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") } |
