diff options
Diffstat (limited to 'pkg/lang/parser/parser_test.go')
| -rw-r--r-- | pkg/lang/parser/parser_test.go | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/pkg/lang/parser/parser_test.go b/pkg/lang/parser/parser_test.go index f48b6a5..b756b1b 100644 --- a/pkg/lang/parser/parser_test.go +++ b/pkg/lang/parser/parser_test.go @@ -384,34 +384,38 @@ func TestIfStmt(t *testing.T) { require.Equal(t, ast.Stmt{ Kind: ast.StmtKindIf, Value: ast.StmtIf{ - Cond: ast.Expr{ - At: source.NewLoc(0, 3), - Kind: ast.ExprKindBoolLit, - Value: ast.ExprBoolLit{Value: false}, - }, - Then: ast.BlockNode{ - At: source.NewLoc(0, 9), - Stmts: []ast.Stmt{ - { - At: source.NewLoc(0, 10), - Kind: ast.StmtKindEmpty, - Value: ast.StmtEmpty{}, + Conds: []ast.CondNode{ + { + At: source.NewLoc(0, 0), + Cond: ast.Expr{ + At: source.NewLoc(0, 3), + Kind: ast.ExprKindBoolLit, + Value: ast.ExprBoolLit{Value: false}, }, - { - At: source.NewLoc(1, 1), - Kind: ast.StmtKindVarDecl, - Value: ast.StmtVarDecl{ - Name: ast.IdentNode{At: source.NewLoc(1, 5), Value: "x"}, - Value: ast.Expr{ - At: source.NewLoc(1, 9), - Kind: ast.ExprKindIntLit, - Value: ast.ExprIntLit{Value: 2}, + Then: ast.BlockNode{ + At: source.NewLoc(0, 9), + Stmts: []ast.Stmt{ + { + At: source.NewLoc(0, 10), + Kind: ast.StmtKindEmpty, + Value: ast.StmtEmpty{}, + }, + { + At: source.NewLoc(1, 1), + Kind: ast.StmtKindVarDecl, + Value: ast.StmtVarDecl{ + Name: ast.IdentNode{At: source.NewLoc(1, 5), Value: "x"}, + Value: ast.Expr{ + At: source.NewLoc(1, 9), + Kind: ast.ExprKindIntLit, + Value: ast.ExprIntLit{Value: 2}, + }, + }, }, }, }, }, }, - Elifs: []ast.CondNode{}, }, }, program.Stmts[0]) } |
