diff options
Diffstat (limited to 'usr/austin/eval/eval_test.go')
-rw-r--r-- | usr/austin/eval/eval_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr/austin/eval/eval_test.go b/usr/austin/eval/eval_test.go index 75c30a7a5..192a2e782 100644 --- a/usr/austin/eval/eval_test.go +++ b/usr/austin/eval/eval_test.go @@ -65,7 +65,7 @@ func (a test) run(t *testing.T, name string) { t.Errorf("%s: Compile %s succeeded; want %s", name, src, j.cerr); break; } - + val, err := code.Run(); if err != nil { if j.rterr == "" { @@ -82,7 +82,7 @@ func (a test) run(t *testing.T, name string) { t.Errorf("%s: Run %s succeeded; want %s", name, src, j.rterr); break; } - + if !j.noval && !reflect.DeepEqual(val, j.val) { t.Errorf("%s: Run %s = %T(%v) want %T(%v)", name, src, val, val, j.val, j.val); } @@ -122,6 +122,13 @@ func Run(stmts string) test { return test([]job{job{code: stmts, noval: true}}) } +// Two statements without error. +// TODO(rsc): Should be possible with Run but the parser +// won't let us do both top-level and non-top-level statements. +func Run2(stmt1, stmt2 string) test { + return test([]job{job{code: stmt1, noval: true}, job{code: stmt2, noval: true}}) +} + // Statement runs and test one expression's value func Val1(stmts string, expr1 string, val1 interface{}) test { return test([]job{ |