Skip to content

Commit

Permalink
Add tests and update refs.
Browse files Browse the repository at this point in the history
  • Loading branch information
akshanshbhatt committed Aug 9, 2022
1 parent cfa11dc commit 9dd3190
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/parser/unicode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def test_frompyfunc_name(self):
# name conversion was failing for python 3 strings
# resulting in the default '?' name. Also test utf-8
# encoding using non-ascii name.
def cassé(x):
return x

ℙƴtℌøἤ = 1
print(ℙƴtℌøἤ)

if != 2:
pass

def क१():
...
13 changes: 13 additions & 0 deletions tests/reference/ast_new-unicode-d3199dc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "ast_new-unicode-d3199dc",
"cmd": "lpython --show-ast --new-parser --no-color {infile} -o {outfile}",
"infile": "tests/parser/unicode.py",
"infile_hash": "6b3cd163f80b29c927ea2538095688bb9d903c15b5e4a782dc821db5",
"outfile": null,
"outfile_hash": null,
"stdout": "ast_new-unicode-d3199dc.stdout",
"stdout_hash": "bdca5ecb774b300120d0fb96e5d605081cc605679407404407f9b050",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/ast_new-unicode-d3199dc.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(Module [(FunctionDef test_frompyfunc_name ([] [(self () ())] [] [] [] [] []) [(FunctionDef cassé ([] [(x () ())] [] [] [] [] []) [(Return (Name x Load))] [] () ())] [] () ()) (Assign [(Name ℙƴtℌøἤ Store)] (ConstantInt 1 ()) ()) (Expr (Call (Name print Load) [(Name ℙƴtℌøἤ Load)] [])) (If (Compare (Name 诶 Load) NotEq [(ConstantInt 2 ())]) [(Pass)] []) (FunctionDef क१ ([] [] [] [] [] [] []) [(Expr (ConstantEllipsis ()))] [] () ())] [])
4 changes: 4 additions & 0 deletions tests/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ ast_new = true
filename = "parser/type_comment1.py"
ast_new = true

[[test]]
filename = "parser/unicode.py"
ast_new = true

# tests/errors

[[test]]
Expand Down

0 comments on commit 9dd3190

Please sign in to comment.