diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-08-26 21:36:08 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-08-27 11:51:40 +0200 |
| commit | a3857c4e90fa4a3fbe78bd4b53cdc77aa91533cf (patch) | |
| tree | 8bc28379a29112de7bc11c57f3d91d0baba84594 /pkg/compiler/compiler_test.go | |
| parent | 9ec49e082f811482ecdccc837c27961d68247d25 (diff) | |
pkg/compiler, sys/syz-sysgen: move const handling to pkg/compiler
Now pkg/compiler deals with consts.
Diffstat (limited to 'pkg/compiler/compiler_test.go')
| -rw-r--r-- | pkg/compiler/compiler_test.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 13ed97b4c..e68d97d3e 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -11,13 +11,15 @@ import ( ) func TestExtractConsts(t *testing.T) { - top, ok := ast.Parse([]byte(extractConstsInput), "test", nil) - if !ok { + desc := ast.Parse([]byte(extractConstsInput), "test", nil) + if desc == nil { t.Fatalf("failed to parse input") } - consts, includes, incdirs, defines := ExtractConsts(top) - wantConsts := []string{"CONST1", "CONST2", "CONST3", "CONST4", "CONST5", - "CONST6", "CONST7", "__NR_bar", "__NR_foo"} + consts, includes, incdirs, defines := ExtractConsts(desc) + wantConsts := []string{"CONST1", "CONST10", "CONST11", "CONST12", "CONST13", + "CONST14", "CONST15", "CONST16", + "CONST2", "CONST3", "CONST4", "CONST5", + "CONST6", "CONST7", "CONST8", "CONST9", "__NR_bar", "__NR_foo"} if !reflect.DeepEqual(consts, wantConsts) { t.Fatalf("got consts:\n%q\nwant:\n%q", consts, wantConsts) } @@ -56,4 +58,8 @@ str { f1 const[CONST6, int32] f2 array[array[int8, CONST7]] } + +bar$BAZ(x vma[opt], y vma[CONST8], z vma[CONST9:CONST10]) +bar$QUX(s ptr[in, string["foo", CONST11]], x csum[s, pseudo, CONST12]) +bar$FOO(x int8[8:CONST13], y int16be[CONST14:10], z intptr[CONST15:CONST16]) ` |
