Skip to content

Commit

Permalink
Add compile time test for string to list
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Sep 5, 2022
1 parent 32032e6 commit 764d337
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ RUN(NAME test_version LABELS cpython llvm)
RUN(NAME vec_01 LABELS cpython llvm)
RUN(NAME test_str_comparison LABELS cpython llvm)
RUN(NAME test_bit_length LABELS cpython llvm)
RUN(NAME str_to_list_cast LABELS cpython llvm)

RUN(NAME generics_01 LABELS cpython llvm)
RUN(NAME generics_02 LABELS cpython llvm)
Expand Down
14 changes: 14 additions & 0 deletions integration_tests/str_to_list_cast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def f():
x: list[str]
x = list("lpython")
s: str
s = "lpython"
i: i32
for i in range(len(s)):
assert x[i] == s[i]
x = list("")
assert len(x) == 0
x = list("L")
assert len(x) == 1 and x[0] == 'L'

f()

0 comments on commit 764d337

Please sign in to comment.