Skip to content

Commit a0f1217

Browse files
committed
TEST: Add error tests for diff type ann cases
1 parent a14eb2c commit a0f1217

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

tests/errors/func_08.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from lpython import InOut
2+
3+
def main0(x: In[In[i32]]):
4+
print(x)
5+
main0()

tests/errors/test_annassign_01.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_annassign_01():
2+
a: Optional[i32] = 5
3+
4+
test_annassign_01()

tests/errors/test_annassign_02.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_annassign_02():
2+
hex_pat : Pattern[str] = r'-?0[xX]+'
3+
4+
test_annassign_02()

tests/errors/test_annassign_03.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@dataclass
2+
class LasrLexer:
3+
_len: i32
4+
5+
def test_annassign_03():
6+
lexer : InOut[LasrLexer] = LasrLexer(5)
7+
8+
test_annassign_03()

tests/tests.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,18 @@ asr = true
745745
filename = "errors/test_list_slicing.py"
746746
asr = true
747747

748+
[[test]]
749+
filename = "errors/test_annassign_01.py"
750+
asr = true
751+
752+
[[test]]
753+
filename = "errors/test_annassign_02.py"
754+
asr = true
755+
756+
[[test]]
757+
filename = "errors/test_annassign_03.py"
758+
asr = true
759+
748760
[[test]]
749761
filename = "errors/test_annassign_type_mismatch.py"
750762
asr = true
@@ -1147,6 +1159,10 @@ asr = true
11471159
filename = "errors/func_07.py"
11481160
asr = true
11491161

1162+
[[test]]
1163+
filename = "errors/func_08.py"
1164+
asr = true
1165+
11501166
# tests/runtime_errors
11511167
[[test]]
11521168
filename = "runtime_errors/test_list_01.py"

0 commit comments

Comments
 (0)