Skip to content

Commit 1d3f597

Browse files
authored
Fix tests (#14)
1 parent 4d6bc4e commit 1d3f597

15 files changed

+20
-3
lines changed

test_main.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_ast(n: int):
5656
],
5757
)
5858
def test_sem_errors(name: str, line_numbers: list[int], additional: str):
59-
result = runner.invoke(app, ["sem", f"tests/semantic/input_{name}.txt"])
59+
result = runner.invoke(app, ["sem", f"tests/semantic/{name}.txt"])
6060
assert result.exit_code == 0
6161
for ln in line_numbers:
6262
assert f"line {ln}" in result.stdout
@@ -115,3 +115,20 @@ def test_interpreter(name: str, output: str):
115115
def test_interpreter_return():
116116
result = runner.invoke(app, ["run", "tests/interpreter/return.txt"])
117117
assert result.exit_code == 1
118+
119+
120+
@pytest.mark.parametrize(
121+
"name",
122+
[
123+
"parser/input_1.txt",
124+
"parser/input_2.txt",
125+
"ast/input_1.txt",
126+
"ast/input_2.txt",
127+
"ast/input_3.txt",
128+
],
129+
)
130+
def test_all_on_previous_tests(
131+
name: str,
132+
): # run interpreter on parser tests and AST tests
133+
result = runner.invoke(app, ["run", f"tests/{name}"])
134+
assert result.exit_code == 0

tests/parser/input_1.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ string_1 = "#Hello!";
1818

1919
print H';
2020

21-
a = 1;
22-
b = 2;
21+
a = 1.0;
22+
b = 2.0;
2323

2424
a += b;
2525
a /= b;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)