Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Oct 25, 2023
1 parent 2b78854 commit 87f24f0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/parser/syntax/test_dynamic_array.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from vyper import compiler
from vyper.exceptions import ArrayIndexException, StructureException
from vyper.exceptions import StructureException

fail_list = [
(
Expand Down
53 changes: 52 additions & 1 deletion tests/parser/syntax/test_for_range.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from vyper import compiler
from vyper.exceptions import StructureException
from vyper.exceptions import InvalidType, StructureException, TypeMismatch

fail_list = [
(
Expand All @@ -16,6 +16,15 @@ def foo():
(
"""
@external
def bar():
for i in range(1,2,bound=0):
pass
""",
StructureException,
),
(
"""
@external
def bar():
for i in range(1,2,bound=2):
pass
Expand All @@ -32,6 +41,48 @@ def bar():
""",
StructureException,
),
(
"""
@external
def bar():
x:uint256 = 1
y:uint256 = 2
for i in range(x,y+1):
pass
""",
StructureException,
),
(
"""
@external
def bar():
x:uint256 = 1
for i in range(x,x+0):
pass
""",
StructureException,
),
(
"""
@external
def bar(x: uint256):
for i in range(3, x):
pass
""",
InvalidType,
),
(
"""
FOO: constant(int128) = 3
BAR: constant(uint256) = 7
@external
def foo():
for i in range(FOO, BAR):
pass
""",
TypeMismatch,
),
]


Expand Down

0 comments on commit 87f24f0

Please sign in to comment.