aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast/test_util.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-23 13:43:43 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-23 13:50:02 +0100
commit7a7c747c6f5f732d614cea2404386913e68981a0 (patch)
treec62ec3f909aab845d7d5713e916034aeafae157e /pkg/ast/test_util.go
parente229ac7779c82d5cdf27243e7699a2175c785f80 (diff)
pkg/compiler: allow unions as syscall arguments
If all union options can be syscall arguments, allow the union itself as syscall argument.
Diffstat (limited to 'pkg/ast/test_util.go')
-rw-r--r--pkg/ast/test_util.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/ast/test_util.go b/pkg/ast/test_util.go
index b9fe12152..fbec645b7 100644
--- a/pkg/ast/test_util.go
+++ b/pkg/ast/test_util.go
@@ -8,6 +8,7 @@ import (
"bytes"
"io/ioutil"
"path/filepath"
+ "regexp"
"strings"
"testing"
)
@@ -60,7 +61,12 @@ func NewErrorMatcher(t *testing.T, file string) *ErrorMatcher {
}
}
+var errorLocationRe = regexp.MustCompile("at [a-z][a-z0-9]+\\.txt:[0-9]+:[0-9]+")
+
func (em *ErrorMatcher) ErrorHandler(pos Pos, msg string) {
+ if match := errorLocationRe.FindStringSubmatchIndex(msg); match != nil {
+ msg = msg[0:match[0]] + "at LOCATION" + msg[match[1]:]
+ }
em.got = append(em.got, &errorDesc{
file: pos.File,
line: pos.Line,