Skip to content

Commit

Permalink
Register the errors
Browse files Browse the repository at this point in the history
  • Loading branch information
namannimmo10 authored and certik committed Jun 21, 2022
1 parent 45b3919 commit b164bcd
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/errors/test_bitwise_on_complex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from ltypes import c32

def f():
c1: c32
c1 = 4+5j
c2: c32
c2 = -5.6-3j
print(c1 | c2)


f()
11 changes: 11 additions & 0 deletions tests/errors/test_bitwise_on_float.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from ltypes import f32

def f():
f1: f32
f1 = 4.5
f2: f32
f2 = 6.7
print(f1 << f2)


f()
13 changes: 13 additions & 0 deletions tests/reference/asr-test_bitwise_on_complex-dd9568b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-test_bitwise_on_complex-dd9568b",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/errors/test_bitwise_on_complex.py",
"infile_hash": "5e03de6348ffb4fa922d726b314eb95eef2f332404e6be94f0b20139",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_bitwise_on_complex-dd9568b.stderr",
"stderr_hash": "58f7acb7f7187308d38c7c97fcd9e34b2022c42be1b6583b95b379af",
"returncode": 2
}
5 changes: 5 additions & 0 deletions tests/reference/asr-test_bitwise_on_complex-dd9568b.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
semantic error: Unsupported binary operation on complex: '|'
--> tests/errors/test_bitwise_on_complex.py:8:11
|
8 | print(c1 | c2)
| ^^^^^^^
13 changes: 13 additions & 0 deletions tests/reference/asr-test_bitwise_on_float-2e09b30.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "asr-test_bitwise_on_float-2e09b30",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/errors/test_bitwise_on_float.py",
"infile_hash": "db0fdc79b1041fc5745a4bc839181d870f95d8ebd5169a29530cb178",
"outfile": null,
"outfile_hash": null,
"stdout": null,
"stdout_hash": null,
"stderr": "asr-test_bitwise_on_float-2e09b30.stderr",
"stderr_hash": "1e77fcf2484ec7c10436c14ac2a498db59706d30d3c294b89b6b9090",
"returncode": 2
}
5 changes: 5 additions & 0 deletions tests/reference/asr-test_bitwise_on_float-2e09b30.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
semantic error: Unsupported binary operation on floats: '<<'
--> tests/errors/test_bitwise_on_float.py:8:11
|
8 | print(f1 << f2)
| ^^^^^^^^
8 changes: 8 additions & 0 deletions tests/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,14 @@ asr = true
filename = "errors/test_str_to_int.py"
asr = true

[[test]]
filename = "errors/test_bitwise_on_float.py"
asr = true

[[test]]
filename = "errors/test_bitwise_on_complex.py"
asr = true

# tests/tokens/errors

[[test]]
Expand Down

0 comments on commit b164bcd

Please sign in to comment.