Commit 23eee370 authored by Johannes Bechberger's avatar Johannes Bechberger
Browse files

Add semantic test runner

parent 713da1c4
......@@ -111,7 +111,8 @@ class Environment:
mode_flag = {
TestMode.lexer: "--lextest",
TestMode.syntax: "--parsetest",
TestMode.ast: "--print-ast"
TestMode.ast: "--print-ast",
TestMode.semantic: "--check"
cmd = [self.mj_run_cmd, mode_flag] + list(args)
return execute(cmd, timeout=self.timeout)
from mjtest.environment import TestMode
from mjtest.test.syntax_tests import BasicSyntaxTest
from mjtest.test.tests import TestCase
class BasicSemanticTest(BasicSyntaxTest):
FILE_ENDINGS = [".invalid.mj", ".valid.mj", ".mj", "", ".java"]
MODE = TestMode.semantic
\ No newline at end of file
......@@ -127,12 +127,15 @@ class TestSuite:
failed = 0
count = 0
for test_case in self.test_cases[mode]:
ret = self._run_test_case(test_case)
if ret is False or not ret.is_correct():
failed += 1
count += 1
except KeyboardInterrupt:
return RunResult(count, failed)
return RunResult(count, failed)
def _func(self, test_case: 'TestCase'):
......@@ -425,3 +428,4 @@ TestCase.TEST_CASE_CLASSES[TestMode.lexer].append(LexerDiffTest)
import mjtest.test.syntax_tests
import mjtest.test.ast_tests
import mjtest.test.semantic_tests
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment