Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added assert, schema and remaining statement, test cases #12

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions test/corpus/assert.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
================================================================================
assert statements
================================================================================

assert x > 1

--------------------------------------------------------------------------------

(module
(assert_statement
(comparison_operator
(identifier)
(integer))))

================================================================================
assert statements using if expression
================================================================================

assert a > 2 if a

--------------------------------------------------------------------------------

(module
(assert_statement
(comparison_operator
(identifier)
(integer))
(identifier)))

================================================================================
assert statements with error message
================================================================================

assert a == b, "SOS"

--------------------------------------------------------------------------------

(module
(assert_statement
(comparison_operator
(identifier)
(identifier))
(string
(string_start)
(string_content)
(string_end))))
22 changes: 22 additions & 0 deletions test/corpus/schema.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
================================================================================
Schema Statement
================================================================================

schema Person:
firstName: str = "John"

--------------------------------------------------------------------------------

(module
(schema_statement
(identifier)
(block
(assignment
(dotted_name
(identifier))
(type
(basic_type))
(string
(string_start)
(string_content)
(string_end))))))
63 changes: 62 additions & 1 deletion test/corpus/stmt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if True: a = 1
(integer)))))

================================================================================
if statement inline
if statement Basic
================================================================================

if True:
Expand All @@ -37,3 +37,64 @@ if True:
(dotted_name
(identifier))
(integer)))))

================================================================================
if statement with else
================================================================================

if True:
a = 1
else:
b = 2

--------------------------------------------------------------------------------

(module
(if_statement
(true)
(block
(assignment
(dotted_name
(identifier))
(integer)))
(else_clause
(block
(assignment
(dotted_name
(identifier))
(integer))))))

================================================================================
if statement with elif and else
================================================================================

if True:
a = 1
elif False:
b = 2
else:
c = 3

--------------------------------------------------------------------------------

(module
(if_statement
(true)
(block
(assignment
(dotted_name
(identifier))
(integer)))
(elif_clause
(false)
(block
(assignment
(dotted_name
(identifier))
(integer))))
(else_clause
(block
(assignment
(dotted_name
(identifier))
(integer))))))
Loading