-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw Exception for wrong arg type in join method (#2364)
* Throw Exception for wrong argtype in join method * Remove SemanticError from test_str_01.py * Add reference for test handling join method * Remove .stdout file * Run reference test * Remove unnecessary files * Include update references * Update tests/errors/string_01.py Co-authored-by: Shaikh Ubaid <[email protected]> * Update test reference * Remove .stdout file * Add test for corner cases * Remove unused import --------- Co-authored-by: Shaikh Ubaid <[email protected]>
- Loading branch information
1 parent
37eca1a
commit 5c0b91e
Showing
6 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from lpython import i32 | ||
|
||
def test_wrong_argument_in_join(): | ||
x: str = "ab" | ||
p: i32 = 1 | ||
res:str = x.join(p) | ||
print(res) | ||
|
||
test_wrong_argument_in_join() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"basename": "asr-string_02-499c9ff", | ||
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}", | ||
"infile": "tests/errors/string_02.py", | ||
"infile_hash": "ed6511565e893791a4bd8ea0b4750817bab13cd6dc0731332127bf58", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": null, | ||
"stdout_hash": null, | ||
"stderr": "asr-string_02-499c9ff.stderr", | ||
"stderr_hash": "368ba74a1e0d6609f71e6f87f95bd0b6151420c81336e48a172cb613", | ||
"returncode": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
semantic error: str.join() takes type list only | ||
--> tests/errors/string_02.py:6:15 | ||
| | ||
6 | res:str = x.join(p) | ||
| ^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters