diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-08-28 15:59:22 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-02 13:06:53 +0200 |
| commit | a7206b24cac96c08aecf2f3b4cc3c2e555eec708 (patch) | |
| tree | 80c678141148ce2eafaab5617f168bd840b8c8a6 /pkg/compiler/compiler_test.go | |
| parent | aa51461a34f998908d10f551615ad242bdff8fe9 (diff) | |
pkg/compiler: check and generate types
Move most of the logic from sysgen to pkg/compiler.
Update #217
Diffstat (limited to 'pkg/compiler/compiler_test.go')
| -rw-r--r-- | pkg/compiler/compiler_test.go | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 1ef77a19c..261cffe9c 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -12,7 +12,6 @@ import ( ) func TestCompileAll(t *testing.T) { - t.Skip() eh := func(pos ast.Pos, msg string) { t.Logf("%v: %v", pos, msg) } @@ -31,13 +30,12 @@ func TestCompileAll(t *testing.T) { } } -func init() { - typeCheck = true -} - func TestErrors(t *testing.T) { consts := map[string]uint64{ "__NR_foo": 1, + "C0": 0, + "C1": 1, + "C2": 2, } name := "errors.txt" em := ast.NewErrorMatcher(t, filepath.Join("testdata", name)) @@ -46,6 +44,26 @@ func TestErrors(t *testing.T) { em.DumpErrors(t) t.Fatalf("parsing failed") } + ExtractConsts(desc, em.ErrorHandler) Compile(desc, consts, em.ErrorHandler) em.Check(t) } + +func TestFuzz(t *testing.T) { + inputs := []string{ + "d~^gB̉`i\u007f?\xb0.", + "da[", + "define\x98define(define\x98define\x98define\x98define\x98define)define\tdefin", + "resource g[g]", + } + consts := map[string]uint64{"A": 1, "B": 2, "C": 3, "__NR_C": 4} + 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, eh) + } + } +} |
