Skip to content

Commit

Permalink
Add new tests and update refs.
Browse files Browse the repository at this point in the history
  • Loading branch information
akshanshbhatt committed Jul 2, 2022
1 parent 72f3fb5 commit c5aaba3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions tests/parser/for1.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@

for j in k: # type: List[str]
pass

for i in range(5): # type:int
pass
else:
pass
4 changes: 2 additions & 2 deletions tests/reference/ast_new-for1-887432e.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "ast_new-for1-887432e",
"cmd": "lpython --show-ast --new-parser --no-color {infile} -o {outfile}",
"infile": "tests/parser/for1.py",
"infile_hash": "49ae6ad7367743c7853fd97fda61db0ecb8b798744080ccac8580e6b",
"infile_hash": "f025995384e87a428a605ae718932f3fbc25aa3f8baa5508f2018997",
"outfile": null,
"outfile_hash": null,
"stdout": "ast_new-for1-887432e.stdout",
"stdout_hash": "6403fd5e66f74fcc9d5eee5e82088f637449deb074f102ba95844013",
"stdout_hash": "ddf8b7ff93327c03459a9ed17dfa3706131a59b3219e2b13739c7a55",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/ast_new-for1-887432e.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(Module [(ImportFrom ltypes [(i32 ())] 0) (For (Name x Store) (Name fruits Load) [(Expr (Call (Name print Load) [(Name x Load)] []))] [] ()) (For (Name x Store) (Name fruits Load) [(Expr (Call (Name print Load) [(Name x Load)] [])) (If (Compare (Name x Load) Eq [(ConstantStr "banana" ())]) [(Break)] [])] [] ()) (For (Name x Store) (ConstantStr "banana" ()) [(Expr (Call (Name print Load) [(Name x Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 6 ())] []) [(Expr (Call (Name print Load) [(Name i Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 2 ()) (ConstantInt 30 ()) (ConstantInt 3 ())] []) [(Expr (Call (Name print Load) [(Name i Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(If (Compare (Name i Load) Eq [(ConstantInt 3 ())]) [(Continue)] []) (Expr (Call (Name print Load) [(Name i Load)] []))] [(Expr (Call (Name print Load) [(ConstantStr "Finally Completed!" ())] []))] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(For (Name j Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(Expr (Call (Name print Load) [(Name i Load) (Name j Load)] []))] [] ())] [] ()) (AnnAssign (Name sum Store) (Name i32 Load) (ConstantInt 0 ()) 1) (For (Name j Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(AugAssign (Name sum Store) Add (Name j Load))] [] ()) (For (Tuple [(Name _ Store) (Name x Store)] Store) (Name y Load) [(Pass)] [] ()) (For (Tuple [(Name x Store) (Name y Store)] Store) (Name z Load) [(Pass)] [] ()) (For (Tuple [(Name i Store) (Name a Store)] Store) (Call (Name enumerate Load) [(List [(ConstantInt 4 ()) (ConstantInt 5 ()) (ConstantInt 6 ()) (ConstantInt 7 ())] Load)] []) [(Expr (Call (Name print Load) [(Name i Load) (ConstantStr ": " ()) (Name a Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(Pass)] [] "int") (For (Name j Store) (Name k Load) [(Pass)] [] "List[str]")] [])
(Module [(ImportFrom ltypes [(i32 ())] 0) (For (Name x Store) (Name fruits Load) [(Expr (Call (Name print Load) [(Name x Load)] []))] [] ()) (For (Name x Store) (Name fruits Load) [(Expr (Call (Name print Load) [(Name x Load)] [])) (If (Compare (Name x Load) Eq [(ConstantStr "banana" ())]) [(Break)] [])] [] ()) (For (Name x Store) (ConstantStr "banana" ()) [(Expr (Call (Name print Load) [(Name x Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 6 ())] []) [(Expr (Call (Name print Load) [(Name i Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 2 ()) (ConstantInt 30 ()) (ConstantInt 3 ())] []) [(Expr (Call (Name print Load) [(Name i Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(If (Compare (Name i Load) Eq [(ConstantInt 3 ())]) [(Continue)] []) (Expr (Call (Name print Load) [(Name i Load)] []))] [(Expr (Call (Name print Load) [(ConstantStr "Finally Completed!" ())] []))] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(For (Name j Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(Expr (Call (Name print Load) [(Name i Load) (Name j Load)] []))] [] ())] [] ()) (AnnAssign (Name sum Store) (Name i32 Load) (ConstantInt 0 ()) 1) (For (Name j Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(AugAssign (Name sum Store) Add (Name j Load))] [] ()) (For (Tuple [(Name _ Store) (Name x Store)] Store) (Name y Load) [(Pass)] [] ()) (For (Tuple [(Name x Store) (Name y Store)] Store) (Name z Load) [(Pass)] [] ()) (For (Tuple [(Name i Store) (Name a Store)] Store) (Call (Name enumerate Load) [(List [(ConstantInt 4 ()) (ConstantInt 5 ()) (ConstantInt 6 ()) (ConstantInt 7 ())] Load)] []) [(Expr (Call (Name print Load) [(Name i Load) (ConstantStr ": " ()) (Name a Load)] []))] [] ()) (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(Pass)] [] "int") (For (Name j Store) (Name k Load) [(Pass)] [] "List[str]") (For (Name i Store) (Call (Name range Load) [(ConstantInt 5 ())] []) [(Pass)] [(Pass)] "int")] [])

0 comments on commit c5aaba3

Please sign in to comment.