Skip to content

Commit 138f54b

Browse files
committed
fix: scoping issue and tests
1 parent d27c99b commit 138f54b

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

evaluation_function/tests/test_code_runner.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,48 @@ def test_function_without_return(self, runner):
386386
result = runner.run(code, test_cases=test_cases)
387387

388388
assert result.is_correct
389+
def test_standalone_function_call(self, runner):
390+
"""Test that standalone function calls execute correctly."""
391+
code = """
392+
function increment()
393+
x = x + 1
394+
end function
395+
396+
x = 10
397+
increment()
398+
"""
399+
test_cases = [
400+
ExecutionTestCase(
401+
initial_variables={},
402+
expected_variables={"x": 11},
403+
expected_output=[]
404+
)
405+
]
406+
407+
result = runner.run(code, test_cases=test_cases)
408+
409+
assert result.is_correct
410+
411+
def test_standalone_print_call(self, runner):
412+
"""Test that standalone function call can produce output."""
413+
code = """
414+
function greet()
415+
print("hello")
416+
end function
417+
418+
greet()
419+
"""
420+
test_cases = [
421+
ExecutionTestCase(
422+
initial_variables={},
423+
expected_variables={},
424+
expected_output=["hello"]
425+
)
426+
]
427+
428+
result = runner.run(code, test_cases=test_cases)
429+
430+
assert result.is_correct
389431

390432

391433
class TestPrintOutput:

0 commit comments

Comments
 (0)