phasm/tests/integration/test_lang/test_function_calls.py
2025-05-21 19:22:45 +02:00

47 lines
849 B
Python

import pytest
from ..helpers import Suite
@pytest.mark.integration_test
def test_call_pre_defined():
code_py = """
def helper(left: i32) -> i32:
return left
@exported
def testEntry() -> i32:
return helper(13)
"""
result = Suite(code_py).run_code()
assert 13 == result.returned_value
@pytest.mark.integration_test
def test_call_post_defined():
code_py = """
@exported
def testEntry() -> i32:
return helper(10, 3)
def helper(left: i32, right: i32) -> i32:
return left - right
"""
result = Suite(code_py).run_code()
assert 7 == result.returned_value
@pytest.mark.integration_test
@pytest.mark.skip('FIXME: Type checking')
def test_call_invalid_type():
code_py = """
def helper(left: i32) -> i32:
return left()
"""
result = Suite(code_py).run_code()
assert 7 == result.returned_value