diff --git a/tests/integration/test_lang/test_primitives.py b/tests/integration/test_lang/test_primitives.py index 076b308..01df9cf 100644 --- a/tests/integration/test_lang/test_primitives.py +++ b/tests/integration/test_lang/test_primitives.py @@ -360,3 +360,17 @@ def helper(left: {type_}, right: {type_}) -> {type_}: assert 32.125 == result.returned_value assert TYPE_MAP[type_] == type(result.returned_value) + +@pytest.mark.integration_test +def test_call_invalid_type(): + code_py = """ +def helper() -> i64: + return 19 + +@exported +def testEntry() -> i32: + return helper() +""" + + with pytest.raises(TypingError, match=r'i32.*i64'): + Suite(code_py).run_code() diff --git a/tests/integration/test_lang/test_type_checks.py b/tests/integration/test_lang/test_type_checks.py deleted file mode 100644 index 1389c2f..0000000 --- a/tests/integration/test_lang/test_type_checks.py +++ /dev/null @@ -1,31 +0,0 @@ -import pytest - -from phasm.parser import phasm_parse -from phasm.typer import phasm_type -from phasm.exceptions import TypingError - -@pytest.mark.integration_test -def test_constant_too_wide(): - code_py = """ -def func_const() -> u8: - return 0xFFF -""" - - ast = phasm_parse(code_py) - with pytest.raises(TypingError, match='Other min bitwidth exceeds max bitwidth'): - phasm_type(ast) - -@pytest.mark.integration_test -@pytest.mark.parametrize('type_', [32, 64]) -def test_signed_mismatch(type_): - code_py = f""" -def func_const() -> u{type_}: - return 0 - -def func_call() -> i{type_}: - return func_const() -""" - - ast = phasm_parse(code_py) - with pytest.raises(TypingError, match='Signed does not match'): - phasm_type(ast)